Rename Xen public interfaces.
1. hypervisor-if.h is now xen.h
2. hypervisor-ifs/ directory is now:
<include/public/...> in Xen
<asm/xen-public/...> in Linux
<xen/...> in user space
404f1bb86rAXB3aLS1vYdcqpJiEcyg xen/include/asm-x86/x86_64/ptrace.h
40e1966azOJZfNI6Ilthe6Q-T3Hewg xen/include/asm-x86/x86_64/string.h
404f1bc4tWkB9Qr8RkKtZGW5eMQzhw xen/include/asm-x86/x86_64/uaccess.h
-400304fcmRQmDdFYEzDh0wcBba9alg xen/include/hypervisor-ifs/COPYING
-404f1bc68SXxmv0zQpXBWGrCzSyp8w xen/include/hypervisor-ifs/arch-x86_32.h
-404f1bc7IwU-qnH8mJeVu0YsNGMrcw xen/include/hypervisor-ifs/arch-x86_64.h
-3ddb79c2PMeWTK86y4C3F4MzHw4A1g xen/include/hypervisor-ifs/dom0_ops.h
-403cd194j2pyLqXD8FJ-ukvZzkPenw xen/include/hypervisor-ifs/event_channel.h
-4121d149udGfSUGhn3k1ECz0bM31nQ xen/include/hypervisor-ifs/grant_table.h
-3ddb79c25UE59iu4JJcbRalx95mvcg xen/include/hypervisor-ifs/hypervisor-if.h
-40f5623bqoi4GEoBiiUc6TZk1HjsMg xen/include/hypervisor-ifs/io/blkif.h
-40dc4076pVeE1kEEWzcUaNZin65kCA xen/include/hypervisor-ifs/io/domain_controller.h
-40f5623cTZ80EwjWUBlh44A9F9i_Lg xen/include/hypervisor-ifs/io/netif.h
-4051db79512nOCGweabrFWO2M2h5ng xen/include/hypervisor-ifs/physdev.h
-40589968wmhPmV5-ENbBYmMjnedgKw xen/include/hypervisor-ifs/sched_ctl.h
-404f3d2eR2Owk-ZcGOx9ULGHg3nrww xen/include/hypervisor-ifs/trace.h
+400304fcmRQmDdFYEzDh0wcBba9alg xen/include/public/COPYING
+404f1bc68SXxmv0zQpXBWGrCzSyp8w xen/include/public/arch-x86_32.h
+404f1bc7IwU-qnH8mJeVu0YsNGMrcw xen/include/public/arch-x86_64.h
+3ddb79c2PMeWTK86y4C3F4MzHw4A1g xen/include/public/dom0_ops.h
+403cd194j2pyLqXD8FJ-ukvZzkPenw xen/include/public/event_channel.h
+4121d149udGfSUGhn3k1ECz0bM31nQ xen/include/public/grant_table.h
+40f5623bqoi4GEoBiiUc6TZk1HjsMg xen/include/public/io/blkif.h
+40dc4076pVeE1kEEWzcUaNZin65kCA xen/include/public/io/domain_controller.h
+40f5623cTZ80EwjWUBlh44A9F9i_Lg xen/include/public/io/netif.h
+4051db79512nOCGweabrFWO2M2h5ng xen/include/public/physdev.h
+40589968wmhPmV5-ENbBYmMjnedgKw xen/include/public/sched_ctl.h
+404f3d2eR2Owk-ZcGOx9ULGHg3nrww xen/include/public/trace.h
+3ddb79c25UE59iu4JJcbRalx95mvcg xen/include/public/xen.h
3e397e66m2tO3s-J8Jnr7Ws_tGoPTg xen/include/xen/ac_timer.h
40715b2epYl2jBbxzz9CI2rgIca7Zg xen/include/xen/acpi.h
3ddb79c0c0cX_DZE209-Bb-Rx1v-Aw xen/include/xen/cache.h
GPL when distributed separately or included in software packages
outside this repository. Instead we specify a much more relaxed
BSD-style license. Affected files include the Xen interface headers
-(xen/include/hypervisor-ifs/COPYING), and various drivers, support
-functions and header files within the Linux sparse source trees. In
-all such cases, license terms are stated at the top of the file or in
-a COPYING file in the same directory. Note that _any_ file that is
-modified and then distributed within a Linux kernel is still subject
-to the GNU GPL!
+(xen/include/public/COPYING), and various drivers, support functions
+and header files within the Linux sparse source trees. In all such
+cases, license terms are stated at the top of the file or in a COPYING
+file in the same directory. Note that _any_ file that is modified and
+then distributed within a Linux kernel is still subject to the GNU GPL.
-- Keir Fraser (on behalf of the Xen team)
By adopting the convention that every request will receive a response,
not all four pointers need be shared and flow control on the ring
becomes very easy to manage. Each domain manages its own
-consumer pointer, and the two producer pointers are visible to both (Xen/include/hypervisor-ifs/io/blkif.h):
-
+consumer pointer, and the two producer pointers are visible to both
+(xen/include/public/io/blkif.h):
/* NB. Ring size must be small enough for sizeof(blkif_ring_t) <=PAGE_SIZE.*/
\subsubsection{sched\_id}
This is an integer that uniquely identifies this scheduler. There should be a
-macro corrsponding to this scheduler ID in {\tt <hypervisor-ifs/sched-if.h>}.
+macro corrsponding to this scheduler ID in {\tt <xen/sched-if.h>}.
\subsubsection{init\_scheduler}
LOBJS := lib/malloc.o lib/math.o lib/printf.o lib/string.o
OBJS := entry.o kernel.o traps.o hypervisor.o mm.o events.o time.o ${LOBJS}
-HINTF := h/hypervisor-ifs/hypervisor-if.h
+HINTF := h/xen-public/xen.h
HDRS := h/os.h h/types.h h/hypervisor.h h/mm.h h/events.h h/time.h h/lib.h
HDRS += $(HINTF)
default: $(TARGET)
-hypervisor-ifs:
- ln -sf ../../../xen/include/hypervisor-ifs h/hypervisor-ifs
+xen-public:
+ [ -e h/xen-public] || ln -sf ../../../xen/include/public h/xen-public
-$(TARGET): hypervisor-ifs head.o $(OBJS)
+$(TARGET): xen-public head.o $(OBJS)
$(LD) -N -T minios.lds head.o $(OBJS) -o $@.elf
objcopy -R .note -R .comment $@.elf $@
gzip -f -9 -c $@ >$@.gz
#ifndef _EVENTS_H_
#define _EVENTS_H_
-/* _EVENT_* are defined in hypervisor-if.h */
+/* _EVENT_* are defined in xen-public/xen.h */
#define EV_BLKDEV _EVENT_BLKDEV
#define EV_TIMER _EVENT_TIMER
#define EV_DIE _EVENT_DIE
#include <types.h>
-/* include the hypervisor interface */
-#include <hypervisor-ifs/hypervisor-if.h>
-#include "../../../tools/xu/lib/domain_controller.h"
+#include <xen-public/xen.h>
+#include <xen-public/io/domain_controller.h>
/*
* a placeholder for the start of day information passed up from the hypervisor
/*
- * these are also defined in hypervisor-if.h but can't be pulled in as
+ * these are also defined in xen-public/xen.h but can't be pulled in as
* they are used in start of day assembly. Need to clean up the .h files
* a bit more...
*/
#ifndef __ASSEMBLY__
#include <types.h>
-#include <hypervisor-ifs/hypervisor-if.h>
+#include <xen-public/xen.h>
/* this struct defines the way the registers are stored on the
@$(MAKEBOOT) clean
archmrproper:
- rm -f include/asm-xen/hypervisor-ifs/arch
+ rm -f include/asm-xen/xen-public/arch
archdep:
@$(MAKEBOOT) dep
#include <linux/hdreg.h>
#include <linux/blkdev.h>
#include <linux/major.h>
-#include <asm/hypervisor-ifs/hypervisor-if.h>
+#include <asm/xen-public/xen.h>
#include <asm/io.h>
#include <asm/atomic.h>
#include <asm/uaccess.h>
-#include <asm-xen/hypervisor-ifs/io/blkif.h>
+#include <asm/xen-public/io/blkif.h>
#if 0
#define DPRINTK(_f, _a...) printk ( KERN_ALERT _f , ## _a )
#include <asm/segment.h>
#include <asm/io.h>
-#include <asm/hypervisor-ifs/hypervisor-if.h>
-#include <asm/hypervisor-ifs/physdev.h>
+#include <asm/xen-public/xen.h>
+#include <asm/xen-public/physdev.h>
#include "pci-i386.h"
#include <asm/desc.h>
#include <asm/mmu_context.h>
#include <asm/multicall.h>
-#include <asm/hypervisor-ifs/dom0_ops.h>
+#include <asm/xen-public/dom0_ops.h>
#include <linux/irq.h>
#include <asm/mmu_context.h>
#include <asm/ctrl_if.h>
#include <asm/hypervisor.h>
-#include <asm/hypervisor-ifs/dom0_ops.h>
+#include <asm/xen-public/dom0_ops.h>
#include <linux/netdevice.h>
#include <linux/rtnetlink.h>
#include <linux/tqueue.h>
* and the bootmem bitmap.
* NB. There is definitely enough room for the bootmem bitmap in the
* bootstrap page table. We are guaranteed to get >=512kB unused 'padding'
- * for our own use after all bootstrap elements (see hypervisor-if.h).
+ * for our own use after all bootstrap elements (see asm/xen-public/xen.h).
*/
boot_pfn = min((int)xen_start_info.nr_pages,lmax_low_pfn);
bootmap_size = init_bootmem(start_pfn,boot_pfn);
#include <asm/div64.h>
#include <asm/hypervisor.h>
-#include <asm/hypervisor-ifs/dom0_ops.h>
+#include <asm/xen-public/dom0_ops.h>
#include <linux/mc146818rtc.h>
#include <linux/kernel.h>
#include <linux/config.h>
#include <linux/string.h>
#include <asm/types.h>
-#include <asm/hypervisor-ifs/hypervisor-if.h>
+#include <asm/xen-public/xen.h>
#ifdef CONFIG_XEN_SCRUB_PAGES
#define scrub_pages(_p,_n) memset((void *)(_p), 0, (_n) << PAGE_SHIFT)
#ifndef __ASSEMBLY__
#include <linux/types.h>
#endif
-#include <asm/hypervisor-ifs/hypervisor-if.h>
+#include <asm/xen-public/xen.h>
#define __KERNEL_CS FLAT_RING1_CS
#define __KERNEL_DS FLAT_RING1_DS
LINUX_26="$1"
-# Create links to the shared definitions of the hypervisor interface
-rm -rf ${AD}/include/asm-xen/hypervisor-ifs
-mkdir ${AD}/include/asm-xen/hypervisor-ifs
-cd ${AD}/include/asm-xen/hypervisor-ifs
-relative_lndir ../../../${RS}/../xen/include/hypervisor-ifs
+# Create links to the shared definitions of the Xen interfaces.
+rm -rf ${AD}/include/asm-xen/xen-public
+mkdir ${AD}/include/asm-xen/xen-public
+cd ${AD}/include/asm-xen/xen-public
+relative_lndir ../../../${RS}/../xen/include/public
# Create a link to the shared definitions for the control interface
cd ${AD}/include/asm-xen
@echo ' SYMLINK $@ -> include/asm-xen/asm-$(XENARCH)'
@ln -fsn asm-$(XENARCH) $@
-include/asm-xen/asm-$(XENARCH)/hypervisor-ifs:
- @echo ' SYMLINK $@ -> include/asm-xen/hypervisor-ifs'
- @ln -fsn ../hypervisor-ifs $@
+include/asm-xen/asm-$(XENARCH)/xen-public:
+ @echo ' SYMLINK $@ -> include/asm-xen/xen-public'
+ @ln -fsn ../xen-public $@
arch/xen/arch:
@rm -f $@
@ln -fsn $(XENARCH) $@
prepare: include/.asm-ignore include/asm-xen/asm \
- include/asm-xen/asm-$(XENARCH)/hypervisor-ifs \
+ include/asm-xen/asm-$(XENARCH)/xen-public \
arch/xen/arch ;
all: vmlinuz
#include <asm/smp.h>
#include <asm/page.h>
#include "irq_vectors.h"
-#include <asm/hypervisor-ifs/hypervisor-if.h>
+#include <asm/xen-public/xen.h>
#define nr_syscalls ((syscall_table_size)/4)
#include <asm/segment.h>
#include <asm/thread_info.h>
#include <asm/asm_offsets.h>
-#include <asm/hypervisor-ifs/arch-x86_32.h>
+#include <asm/xen-public/arch-x86_32.h>
/*
* References to members of the new_cpu_data structure.
#include <linux/smp_lock.h>
#include <linux/stddef.h>
#include <linux/slab.h>
-#include <asm/hypervisor-ifs/dom0_ops.h>
+#include <asm/xen-public/dom0_ops.h>
asmlinkage long sys_iopl(unsigned int new_io_pl)
{
#include <asm/irq.h>
#include <asm/desc.h>
#include <asm-xen/multicall.h>
-#include <asm/hypervisor-ifs/dom0_ops.h>
+#include <asm/xen-public/dom0_ops.h>
#ifdef CONFIG_MATH_EMULATION
#include <asm/math_emu.h>
#endif
#include <linux/init.h>
#include "pci.h"
-#include <asm/hypervisor-ifs/hypervisor-if.h>
-#include <asm/hypervisor-ifs/physdev.h>
+#include <asm/xen-public/xen.h>
+#include <asm/xen-public/physdev.h>
/*
* Functions for accessing PCI configuration space with type xen accesses
#include "pci.h"
-#include <asm/hypervisor-ifs/hypervisor-if.h>
-#include <asm/hypervisor-ifs/physdev.h>
+#include <asm/xen-public/xen.h>
+#include <asm/xen-public/physdev.h>
/*
* Never use: 0, 1, 2 (timer, keyboard, and cascade)
#include <asm/system.h>
#include <asm/ptrace.h>
#include <asm/synch_bitops.h>
-#include <asm/hypervisor-ifs/event_channel.h>
-#include <asm/hypervisor-ifs/physdev.h>
+#include <asm/xen-public/event_channel.h>
+#include <asm/xen-public/physdev.h>
#include <asm-xen/ctrl_if.h>
#include <asm-xen/hypervisor.h>
#include <asm/mmu_context.h>
#include <asm-xen/ctrl_if.h>
#include <asm-xen/hypervisor.h>
-#include <asm-xen/hypervisor-ifs/dom0_ops.h>
+#include <asm-xen/xen-public/dom0_ops.h>
#include <asm-xen/suspend.h>
#include <asm-xen/queues.h>
#include <asm/pgalloc.h>
#include <asm-xen/ctrl_if.h>
#include <asm-xen/hypervisor.h>
-#include <asm-xen/hypervisor-ifs/io/blkif.h>
+#include <asm-xen/xen-public/io/blkif.h>
#if 0
#define ASSERT(_p) \
#include <linux/blkdev.h>
#include <linux/major.h>
#include <linux/devfs_fs_kernel.h>
-#include <asm/hypervisor-ifs/hypervisor-if.h>
-#include <asm-xen/hypervisor-ifs/io/blkif.h>
+#include <asm/xen-public/xen.h>
+#include <asm-xen/xen-public/io/blkif.h>
#include <asm/io.h>
#include <asm/atomic.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
-#include <asm/hypervisor-ifs/event_channel.h>
+#include <asm/xen-public/event_channel.h>
#include <asm-xen/hypervisor.h>
#include <asm-xen/evtchn.h>
#include <asm-xen/ctrl_if.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <asm-xen/ctrl_if.h>
-#include <asm-xen/hypervisor-ifs/io/netif.h>
+#include <asm-xen/xen-public/io/netif.h>
#include <asm/io.h>
#include <asm/pgalloc.h>
#include <asm/io.h>
#include <asm-xen/evtchn.h>
#include <asm-xen/ctrl_if.h>
-#include <asm-xen/hypervisor-ifs/io/netif.h>
+#include <asm-xen/xen-public/io/netif.h>
#include <asm/page.h>
#include <net/arp.h>
#include <asm/uaccess.h>
#include <asm/tlb.h>
#include <asm-xen/proc_cmd.h>
-#include <asm/hypervisor-ifs/dom0_ops.h>
+#include <asm/xen-public/dom0_ops.h>
#include <asm-xen/xen_proc.h>
static struct proc_dir_entry *privcmd_intf;
#include <linux/config.h>
#include <linux/string.h>
#include <linux/types.h>
-#include <asm/hypervisor-ifs/hypervisor-if.h>
+#include <asm/xen-public/xen.h>
#ifdef CONFIG_XEN_SCRUB_PAGES
#define scrub_pages(_p,_n) memset((void *)(_p), 0, (_n) << PAGE_SHIFT)
#include <asm-xen/hypervisor.h>
#include <asm/ptrace.h>
#include <asm/synch_bitops.h>
-#include <asm/hypervisor-ifs/event_channel.h>
+#include <asm/xen-public/event_channel.h>
/*
* LOW-LEVEL DEFINITIONS
#include <linux/config.h>
#include <asm-xen/hypervisor.h>
-#include <asm-xen/hypervisor-ifs/grant_table.h>
+#include <asm-xen/xen-public/grant_table.h>
int
gnttab_grant_foreign_access(
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/version.h>
-#include <asm/hypervisor-ifs/hypervisor-if.h>
-#include <asm/hypervisor-ifs/dom0_ops.h>
-#include <asm/hypervisor-ifs/io/domain_controller.h>
+#include <asm/xen-public/xen.h>
+#include <asm/xen-public/dom0_ops.h>
+#include <asm/xen-public/io/domain_controller.h>
#include <asm/ptrace.h>
#include <asm/page.h>
rm -f mkbuildtree
-# Create links to the shared definitions of the hypervisor interface
-rm -rf ${AD}/include/asm-xen/hypervisor-ifs
-mkdir ${AD}/include/asm-xen/hypervisor-ifs
-cd ${AD}/include/asm-xen/hypervisor-ifs
-relative_lndir ../../../${RS}/../xen/include/hypervisor-ifs
+# Create links to the shared definitions of the Xen interfaces.
+rm -rf ${AD}/include/asm-xen/xen-public
+mkdir ${AD}/include/asm-xen/xen-public
+cd ${AD}/include/asm-xen/xen-public
+relative_lndir ../../../${RS}/../xen/include/public
rm -f mkbuildtree
-# Create links to the shared definitions of the hypervisor interface
-rm -rf ${AD}/sys/arch/xen/include/hypervisor-ifs
-mkdir ${AD}/sys/arch/xen/include/hypervisor-ifs
-cd ${AD}/sys/arch/xen/include/hypervisor-ifs
-relative_lndir ../../../../../${RS}/../xen/include/hypervisor-ifs
+# Create links to the shared definitions of the Xen interface
+rm -rf ${AD}/sys/arch/xen/include/xen-public
+mkdir ${AD}/sys/arch/xen/include/xen-public
+cd ${AD}/sys/arch/xen/include/xen-public
+relative_lndir ../../../../../${RS}/../xen/include/public
# Remove files which don't exist anymore
rm -rf ${AD}/sys/arch/xen/xen/events.c
/* include the hypervisor interface */
#include <sys/systm.h>
-#include <machine/hypervisor-ifs/hypervisor-if.h>
-#include <machine/hypervisor-ifs/dom0_ops.h>
-#include <machine/hypervisor-ifs/event_channel.h>
-#include <machine/hypervisor-ifs/io/domain_controller.h>
-#include <machine/hypervisor-ifs/io/netif.h>
-#include <machine/hypervisor-ifs/io/blkif.h>
+#include <machine/xen-public/xen.h>
+#include <machine/xen-public/dom0_ops.h>
+#include <machine/xen-public/event_channel.h>
+#include <machine/xen-public/io/domain_controller.h>
+#include <machine/xen-public/io/netif.h>
+#include <machine/xen-public/io/blkif.h>
#undef u8
#undef u16
/*
- * these are also defined in hypervisor-if.h but can't be pulled in as
+ * these are also defined in xen-public/xen.h but can't be pulled in as
* they are used in start of day assembly. Need to clean up the .h files
* a bit more...
*/
#include <machine/xenkbcvar.h>
#include <machine/xen.h>
#include <machine/hypervisor.h>
-#include <machine/hypervisor-ifs/kbd.h>
+#include <machine/xen-public/kbd.h>
#include <machine/evtchn.h>
#define KBC_DELAY DELAY(1000)
# -*- mode: Makefile; -*-
-XEN_HYPERVISOR_IFS = $(XEN_ROOT)/xen/include/hypervisor-ifs
+XEN_HYPERVISOR_IFS = $(XEN_ROOT)/xen/include/public
XEN_LINUX_INCLUDE = $(XEN_ROOT)/linux-xen-sparse/include
XEN_XC = $(XEN_ROOT)/tools/python/xen/lowlevel/xc
XEN_LIBXC = $(XEN_ROOT)/tools/libxc
typedef signed long s32;
typedef signed long long s64;
-#include "xen/hypervisor-if.h"
+#include "xen/xen.h"
#include "xen/dom0_ops.h"
#include "xen/event_channel.h"
#include "xen/sched_ctl.h"
extra_compile_args = [ "-fno-strict-aliasing", "-Wall", "-Werror" ]
-include_dirs = [ XEN_ROOT + "/xen/include/hypervisor-ifs",
- XEN_ROOT + "/linux-xen-sparse/include",
+include_dirs = [ XEN_ROOT + "/linux-xen-sparse/include",
XEN_ROOT + "/tools/python/xen/lowlevel/xu",
XEN_ROOT + "/tools/libxc",
XEN_ROOT + "/tools/libxutil",
#include <signal.h>
#include <xc.h>
-#include <hypervisor-if.h>
-#include <io/domain_controller.h>
+#include <xen/xen.h>
+#include <xen/io/domain_controller.h>
#include <asm-xen/proc_cmd.h>
wrote it.
Further note that the guest-OS interfacing header files, which
-includes all files within the subdirectory include/hypervisor-ifs, are
+includes all files within the subdirectory include/public, are
*not* covered by the GPL but by a much weaker license:
- include/hypervisor-ifs/COPYING
+ include/public/COPYING
Also note that the only valid version of the GPL as far as Xen is
concerned is _this_ particular version of the license (i.e., *only*
install -m0644 $(TARGET).gz $(prefix)/boot
install -m0644 $(TARGET)-syms $(prefix)/boot
mkdir -p $(prefix)/usr/include/xen/io
- install -m0644 include/hypervisor-ifs/*.h $(prefix)/usr/include/xen
- install -m0644 include/hypervisor-ifs/io/*.h $(prefix)/usr/include/xen/io
- install -m0644 include/hypervisor-ifs/COPYING $(prefix)/usr/include/xen
+ install -m0644 include/public/*.h $(prefix)/usr/include/xen
+ install -m0644 include/public/io/*.h $(prefix)/usr/include/xen/io
+ install -m0644 include/public/COPYING $(prefix)/usr/include/xen
dist: $(TARGET)
$(MAKE) prefix=`pwd`/../install dist=yes install
TARGET := $(BASEDIR)/xen
HDRS := $(wildcard $(BASEDIR)/include/xen/*.h)
HDRS += $(wildcard $(BASEDIR)/include/scsi/*.h)
-HDRS += $(wildcard $(BASEDIR)/include/hypervisor-ifs/*.h)
+HDRS += $(wildcard $(BASEDIR)/include/public/*.h)
HDRS += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/*.h)
HDRS += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/$(TARGET_SUBARCH)/*.h)
# compile.h is always regenerated, but other files shouldn't be rebuilt
#include <xen/config.h>
-#include <hypervisor-ifs/hypervisor-if.h>
+#include <public/xen.h>
#include <asm/page.h>
#define SECONDARY_CPU_FLAG 0xA5A5A5A5
#include <xen/config.h>
-#include <hypervisor-ifs/hypervisor-if.h>
+#include <public/xen.h>
#include <asm/page.h>
#include <asm/msr.h>
#include <xen/types.h>
#include <xen/lib.h>
#include <xen/mm.h>
-#include <hypervisor-ifs/dom0_ops.h>
+#include <public/dom0_ops.h>
#include <xen/sched.h>
#include <xen/event.h>
#include <asm/domain_page.h>
#include <xen/trace.h>
#include <xen/console.h>
#include <asm/shadow.h>
-#include <hypervisor-ifs/sched_ctl.h>
+#include <public/sched_ctl.h>
#define TRC_DOM0OP_ENTER_BASE 0x00020000
#define TRC_DOM0OP_LEAVE_BASE 0x00030000
*/
#include <xen/config.h>
-#include <hypervisor-ifs/hypervisor-if.h>
+#include <public/xen.h>
#include <asm/page.h>
#ifdef CONFIG_SMP
#include <xen/config.h>
#include <xen/errno.h>
#include <xen/softirq.h>
-#include <hypervisor-ifs/hypervisor-if.h>
+#include <public/xen.h>
EBX = 0x00
ECX = 0x04
#include <xen/config.h>
#include <xen/types.h>
#include <xen/lib.h>
-#include <hypervisor-ifs/dom0_ops.h>
+#include <public/dom0_ops.h>
#include <asm/pdb.h>
/* from linux/sched.h */
#include <xen/config.h>
#include <xen/types.h>
#include <xen/lib.h>
-#include <hypervisor-ifs/dom0_ops.h>
+#include <public/dom0_ops.h>
#include <xen/sched.h>
#include <xen/event.h>
#include <asm/page.h>
#include <xen/types.h>
#include <xen/lib.h>
#include <xen/mm.h>
-#include <hypervisor-ifs/dom0_ops.h>
+#include <public/dom0_ops.h>
#include <xen/sched.h>
#include <xen/event.h>
#include <asm/domain_page.h>
#include <xen/trace.h>
#include <xen/console.h>
#include <asm/shadow.h>
-#include <hypervisor-ifs/sched_ctl.h>
+#include <public/sched_ctl.h>
#define TRC_DOM0OP_ENTER_BASE 0x00020000
#define TRC_DOM0OP_LEAVE_BASE 0x00030000
#include <xen/time.h>
#include <xen/console.h>
#include <asm/shadow.h>
-#include <hypervisor-ifs/dom0_ops.h>
+#include <public/dom0_ops.h>
#include <asm/domain_page.h>
/* Both these structures are protected by the tasklist_lock. */
#include <xen/event.h>
#include <xen/irq.h>
-#include <hypervisor-ifs/hypervisor-if.h>
-#include <hypervisor-ifs/event_channel.h>
+#include <public/xen.h>
+#include <public/event_channel.h>
#define INIT_EVENT_CHANNELS 16
#define MAX_EVENT_CHANNELS 1024
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/domain_page.h>
-#include <hypervisor-ifs/dom0_ops.h>
+#include <public/dom0_ops.h>
unsigned long xenheap_phys_end;
#include <xen/irq.h>
#include <xen/event.h>
#include <asm/pci.h>
-#include <hypervisor-ifs/hypervisor-if.h>
-#include <hypervisor-ifs/physdev.h>
+#include <public/xen.h>
+#include <public/physdev.h>
/* Called by PHYSDEV_PCI_INITIALISE_DEVICE to finalise IRQ routing. */
extern void pcibios_enable_irq(struct pci_dev *dev);
#include <xen/time.h>
#include <xen/sched.h>
#include <xen/sched-if.h>
-#include <hypervisor-ifs/sched_ctl.h>
+#include <public/sched_ctl.h>
#include <xen/trace.h>
#define ATROPOS_TASK_UNBLOCKED 16
#include <xen/sched.h>
#include <xen/sched-if.h>
-#include <hypervisor-ifs/sched_ctl.h>
+#include <public/sched_ctl.h>
#include <xen/ac_timer.h>
#include <xen/softirq.h>
#include <xen/time.h>
#include <xen/sched-if.h>
#include <xen/softirq.h>
#include <xen/trace.h>
-#include <hypervisor-ifs/sched_ctl.h>
+#include <public/sched_ctl.h>
/*#define WAKE_HISTO*/
/*#define BLOCKTIME_HISTO*/
* it's possible to reconstruct a chronological record of trace events.
*
* See also include/xen/trace.h and the dom0 op in
- * include/hypervisor-ifs/dom0_ops.h
+ * include/public/dom0_ops.h
*/
#include <xen/config.h>
#include <xen/trace.h>
#include <xen/errno.h>
#include <asm/atomic.h>
-#include <hypervisor-ifs/dom0_ops.h>
+#include <public/dom0_ops.h>
/* Pointers to the meta-data objects for all system trace buffers */
struct t_buf *t_bufs[NR_CPUS];
#include <asm/flushtlb.h>
#include <asm/io.h>
-#include <hypervisor-ifs/hypervisor-if.h>
+#include <public/xen.h>
/*
* Per-page-frame information.
#include <asm/ptrace.h>
#include <xen/list.h>
-#include <hypervisor-ifs/dom0_ops.h>
-#include <hypervisor-ifs/hypervisor-if.h> /* for domain id */
+#include <public/dom0_ops.h>
+#include <public/xen.h> /* for domain id */
extern int pdb_initialized;
extern int pdb_com_port;
#include <asm/pdb.h>
#include <xen/config.h>
#include <xen/spinlock.h>
-#include <hypervisor-ifs/hypervisor-if.h>
+#include <public/xen.h>
struct domain;
+++ /dev/null
-XEN NOTICE
-==========
-
-This copyright applies to all files within this subdirectory. All
-other files in the Xen source distribution are covered by version 2 of
-the GNU General Public License.
-
- -- Keir Fraser (on behalf of the Xen team)
-
-=====================================================================
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
+++ /dev/null
-/******************************************************************************
- * arch-i386/hypervisor-if.h
- *
- * Guest OS interface to x86 32-bit Xen.
- */
-
-#ifndef __HYPERVISOR_IF_I386_H__
-#define __HYPERVISOR_IF_I386_H__
-
-/*
- * Pointers and other address fields inside interface structures are padded to
- * 64 bits. This means that field alignments aren't different between 32- and
- * 64-bit architectures.
- */
-/* NB. Multi-level macro ensures __LINE__ is expanded before concatenation. */
-#define __MEMORY_PADDING(_X) u32 __pad_ ## _X
-#define _MEMORY_PADDING(_X) __MEMORY_PADDING(_X)
-#define MEMORY_PADDING _MEMORY_PADDING(__LINE__)
-
-/*
- * SEGMENT DESCRIPTOR TABLES
- */
-/*
- * A number of GDT entries are reserved by Xen. These are not situated at the
- * start of the GDT because some stupid OSes export hard-coded selector values
- * in their ABI. These hard-coded values are always near the start of the GDT,
- * so Xen places itself out of the way.
- *
- * NB. The reserved range is inclusive (that is, both FIRST_RESERVED_GDT_ENTRY
- * and LAST_RESERVED_GDT_ENTRY are reserved).
- */
-#define NR_RESERVED_GDT_ENTRIES 40
-#define FIRST_RESERVED_GDT_ENTRY 256
-#define LAST_RESERVED_GDT_ENTRY \
- (FIRST_RESERVED_GDT_ENTRY + NR_RESERVED_GDT_ENTRIES - 1)
-
-
-/*
- * These flat segments are in the Xen-private section of every GDT. Since these
- * are also present in the initial GDT, many OSes will be able to avoid
- * installing their own GDT.
- */
-#define FLAT_RING1_CS 0x0819 /* GDT index 259 */
-#define FLAT_RING1_DS 0x0821 /* GDT index 260 */
-#define FLAT_RING3_CS 0x082b /* GDT index 261 */
-#define FLAT_RING3_DS 0x0833 /* GDT index 262 */
-
-#define FLAT_GUESTOS_CS FLAT_RING1_CS
-#define FLAT_GUESTOS_DS FLAT_RING1_DS
-#define FLAT_USER_CS FLAT_RING3_CS
-#define FLAT_USER_DS FLAT_RING3_DS
-
-/* And the trap vector is... */
-#define TRAP_INSTR "int $0x82"
-
-
-/*
- * Virtual addresses beyond this are not modifiable by guest OSes. The
- * machine->physical mapping table starts at this address, read-only.
- */
-#define HYPERVISOR_VIRT_START (0xFC000000UL)
-#ifndef machine_to_phys_mapping
-#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
-#endif
-
-#ifndef __ASSEMBLY__
-
-/* NB. Both the following are 32 bits each. */
-typedef unsigned long memory_t; /* Full-sized pointer/address/memory-size. */
-typedef unsigned long cpureg_t; /* Full-sized register. */
-
-/*
- * Send an array of these to HYPERVISOR_set_trap_table()
- */
-#define TI_GET_DPL(_ti) ((_ti)->flags & 3)
-#define TI_GET_IF(_ti) ((_ti)->flags & 4)
-#define TI_SET_DPL(_ti,_dpl) ((_ti)->flags |= (_dpl))
-#define TI_SET_IF(_ti,_if) ((_ti)->flags |= ((!!(_if))<<2))
-typedef struct {
- u8 vector; /* 0: exception vector */
- u8 flags; /* 1: 0-3: privilege level; 4: clear event enable? */
- u16 cs; /* 2: code selector */
- memory_t address; /* 4: code address */
-} PACKED trap_info_t; /* 8 bytes */
-
-typedef struct
-{
- unsigned long ebx;
- unsigned long ecx;
- unsigned long edx;
- unsigned long esi;
- unsigned long edi;
- unsigned long ebp;
- unsigned long eax;
- unsigned long ds;
- unsigned long es;
- unsigned long fs;
- unsigned long gs;
- unsigned long _unused;
- unsigned long eip;
- unsigned long cs;
- unsigned long eflags;
- unsigned long esp;
- unsigned long ss;
-} PACKED execution_context_t;
-
-typedef u64 tsc_timestamp_t; /* RDTSC timestamp */
-
-/*
- * The following is all CPU context. Note that the i387_ctxt block is filled
- * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
- */
-typedef struct {
-#define ECF_I387_VALID (1<<0)
- unsigned long flags;
- execution_context_t cpu_ctxt; /* User-level CPU registers */
- char fpu_ctxt[256]; /* User-level FPU registers */
- trap_info_t trap_ctxt[256]; /* Virtual IDT */
- unsigned int fast_trap_idx; /* "Fast trap" vector offset */
- unsigned long ldt_base, ldt_ents; /* LDT (linear address, # ents) */
- unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
- unsigned long guestos_ss, guestos_esp; /* Virtual TSS (only SS1/ESP1) */
- unsigned long pt_base; /* CR3 (pagetable base) */
- unsigned long debugreg[8]; /* DB0-DB7 (debug registers) */
- unsigned long event_callback_cs; /* CS:EIP of event callback */
- unsigned long event_callback_eip;
- unsigned long failsafe_callback_cs; /* CS:EIP of failsafe callback */
- unsigned long failsafe_callback_eip;
-} PACKED full_execution_context_t;
-
-typedef struct {
- u64 mfn_to_pfn_start; /* MFN of start of m2p table */
- u64 pfn_to_mfn_frame_list; /* MFN of a table of MFNs that
- make up p2m table */
-} PACKED arch_shared_info_t;
-
-#define ARCH_HAS_FAST_TRAP
-
-#endif
-
-#endif
+++ /dev/null
-/******************************************************************************
- * arch-x86_64/hypervisor-if.h
- *
- * Guest OS interface to AMD x86-64 bit Xen.
- */
-
-#ifndef __HYPERVISOR_IF_X86_64_H__
-#define __HYPERVISOR_IF_X86_64_H__
-
-/* Pointers are naturally 64 bits in this architecture; no padding needed. */
-#define _MEMORY_PADDING(_X)
-#define MEMORY_PADDING
-
-/*
- * SEGMENT DESCRIPTOR TABLES
- */
-/*
- * A number of GDT entries are reserved by Xen. These are not situated at the
- * start of the GDT because some stupid OSes export hard-coded selector values
- * in their ABI. These hard-coded values are always near the start of the GDT,
- * so Xen places itself out of the way.
- *
- * NB. The reserved range is inclusive (that is, both FIRST_RESERVED_GDT_ENTRY
- * and LAST_RESERVED_GDT_ENTRY are reserved).
- */
-#define NR_RESERVED_GDT_ENTRIES 40
-#define FIRST_RESERVED_GDT_ENTRY 256
-#define LAST_RESERVED_GDT_ENTRY \
- (FIRST_RESERVED_GDT_ENTRY + NR_RESERVED_GDT_ENTRIES - 1)
-
-/*
- * 64-bit segment selectors
- * These flat segments are in the Xen-private section of every GDT. Since these
- * are also present in the initial GDT, many OSes will be able to avoid
- * installing their own GDT.
- */
-
-#define FLAT_RING3_CS32 0x0823 /* GDT index 260 */
-#define FLAT_RING3_CS64 0x082b /* GDT index 261 */
-#define FLAT_RING3_DS 0x0833 /* GDT index 262 */
-
-#define FLAT_GUESTOS_DS FLAT_RING3_DS
-#define FLAT_GUESTOS_CS FLAT_RING3_CS64
-#define FLAT_GUESTOS_CS32 FLAT_RING3_CS32
-
-#define FLAT_USER_DS FLAT_RING3_DS
-#define FLAT_USER_CS FLAT_RING3_CS64
-#define FLAT_USER_CS32 FLAT_RING3_CS32
-
-/* And the trap vector is... */
-#define TRAP_INSTR "syscall"
-
-/* The machine->physical mapping table starts at this address, read-only. */
-#ifndef machine_to_phys_mapping
-#define machine_to_phys_mapping ((unsigned long *)0xffff810000000000ULL)
-#endif
-
-#ifndef __ASSEMBLY__
-
-/* NB. Both the following are 64 bits each. */
-typedef unsigned long memory_t; /* Full-sized pointer/address/memory-size. */
-typedef unsigned long cpureg_t; /* Full-sized register. */
-
-/*
- * Send an array of these to HYPERVISOR_set_trap_table()
- */
-#define TI_GET_DPL(_ti) ((_ti)->flags & 3)
-#define TI_GET_IF(_ti) ((_ti)->flags & 4)
-#define TI_SET_DPL(_ti,_dpl) ((_ti)->flags |= (_dpl))
-#define TI_SET_IF(_ti,_if) ((_ti)->flags |= ((!!(_if))<<2))
-typedef struct {
- u8 vector; /* 0: exception vector */
- u8 flags; /* 1: 0-3: privilege level; 4: clear event enable? */
- u16 cs; /* 2: code selector */
- u32 __pad; /* 4 */
- memory_t address; /* 8: code address */
-} PACKED trap_info_t; /* 16 bytes */
-
-typedef struct
-{
- unsigned long r15;
- unsigned long r14;
- unsigned long r13;
- unsigned long r12;
- unsigned long rbp;
- unsigned long rbx;
- unsigned long r11;
- unsigned long r10;
- unsigned long r9;
- unsigned long r8;
- unsigned long rax;
- unsigned long rcx;
- unsigned long rdx;
- unsigned long rsi;
- unsigned long rdi;
- unsigned long rip;
- unsigned long cs;
- unsigned long eflags;
- unsigned long rsp;
- unsigned long ss;
-} PACKED execution_context_t;
-
-typedef u64 tsc_timestamp_t; /* RDTSC timestamp */
-
-/*
- * The following is all CPU context. Note that the i387_ctxt block is filled
- * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
- */
-typedef struct {
-#define ECF_I387_VALID (1<<0)
- unsigned long flags;
- execution_context_t cpu_ctxt; /* User-level CPU registers */
- char fpu_ctxt[512]; /* User-level FPU registers */
- trap_info_t trap_ctxt[256]; /* Virtual IDT */
- unsigned long ldt_base, ldt_ents; /* LDT (linear address, # ents) */
- unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
- unsigned long guestos_ss, guestos_esp; /* Virtual TSS (only SS1/ESP1) */
- unsigned long pt_base; /* CR3 (pagetable base) */
- unsigned long debugreg[8]; /* DB0-DB7 (debug registers) */
- unsigned long event_callback_cs; /* CS:EIP of event callback */
- unsigned long event_callback_eip;
- unsigned long failsafe_callback_cs; /* CS:EIP of failsafe callback */
- unsigned long failsafe_callback_eip;
-} PACKED full_execution_context_t;
-
-typedef struct {
- u64 mfn_to_pfn_start; /* MFN of start of m2p table */
- u64 pfn_to_mfn_frame_list; /* MFN of a table of MFNs that
- make up p2m table */
-} PACKED arch_shared_info_t;
-
-#endif /* !__ASSEMBLY__ */
-
-#endif /* __HYPERVISOR_IF_H__ */
+++ /dev/null
-/******************************************************************************
- * dom0_ops.h
- *
- * Process command requests from domain-0 guest OS.
- *
- * Copyright (c) 2002-2003, B Dragovic
- * Copyright (c) 2002-2004, K Fraser
- */
-
-
-#ifndef __DOM0_OPS_H__
-#define __DOM0_OPS_H__
-
-#include "hypervisor-if.h"
-#include "sched_ctl.h"
-
-/*
- * Make sure you increment the interface version whenever you modify this file!
- * This makes sure that old versions of dom0 tools will stop working in a
- * well-defined way (rather than crashing the machine, for instance).
- */
-#define DOM0_INTERFACE_VERSION 0xAAAA0019
-
-/************************************************************************/
-
-#define DOM0_GETMEMLIST 2
-typedef struct {
- /* IN variables. */
- domid_t domain; /* 0 */
- u16 __pad0;
- u32 __pad1;
- memory_t max_pfns; /* 8 */
- MEMORY_PADDING;
- void *buffer; /* 16 */
- MEMORY_PADDING;
- /* OUT variables. */
- memory_t num_pfns; /* 24 */
- MEMORY_PADDING;
-} PACKED dom0_getmemlist_t; /* 32 bytes */
-
-#define DOM0_SCHEDCTL 6
- /* struct sched_ctl_cmd is from sched-ctl.h */
-typedef struct sched_ctl_cmd dom0_schedctl_t;
-
-#define DOM0_ADJUSTDOM 7
-/* struct sched_adjdom_cmd is from sched-ctl.h */
-typedef struct sched_adjdom_cmd dom0_adjustdom_t;
-
-#define DOM0_CREATEDOMAIN 8
-typedef struct {
- /* IN parameters. */
- memory_t memory_kb; /* 0 */
- MEMORY_PADDING;
- u32 cpu; /* 8 */
- u32 __pad0; /* 12 */
- /* IN/OUT parameters. */
- /* If 0, domain is allocated. If non-zero use it unless in use. */
- domid_t domain; /* 16 */
- u16 __pad1;
- /* OUT parameters. */
-} PACKED dom0_createdomain_t; /* 20 bytes */
-
-#define DOM0_DESTROYDOMAIN 9
-typedef struct {
- /* IN variables. */
- domid_t domain; /* 0 */
- u16 __pad;
-} PACKED dom0_destroydomain_t; /* 4 bytes */
-
-#define DOM0_PAUSEDOMAIN 10
-typedef struct {
- /* IN parameters. */
- domid_t domain; /* 0 */
- u16 __pad;
-} PACKED dom0_pausedomain_t; /* 4 bytes */
-
-#define DOM0_UNPAUSEDOMAIN 11
-typedef struct {
- /* IN parameters. */
- domid_t domain; /* 0 */
- u16 __pad;
-} PACKED dom0_unpausedomain_t; /* 4 bytes */
-
-#define DOM0_GETDOMAININFO 12
-typedef struct {
- /* IN variables. */
- domid_t domain; /* 0 */ /* NB. IN/OUT variable. */
- u16 __pad;
- /* OUT variables. */
-#define DOMFLAGS_DYING (1<<0) /* Domain is scheduled to die. */
-#define DOMFLAGS_CRASHED (1<<1) /* Crashed domain; frozen for postmortem. */
-#define DOMFLAGS_SHUTDOWN (1<<2) /* The guest OS has shut itself down. */
-#define DOMFLAGS_PAUSED (1<<3) /* Currently paused by control software. */
-#define DOMFLAGS_BLOCKED (1<<4) /* Currently blocked pending an event. */
-#define DOMFLAGS_RUNNING (1<<5) /* Domain is currently running. */
-#define DOMFLAGS_CPUMASK 255 /* CPU to which this domain is bound. */
-#define DOMFLAGS_CPUSHIFT 8
-#define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code. */
-#define DOMFLAGS_SHUTDOWNSHIFT 16
- u32 flags; /* 4 */
- full_execution_context_t *ctxt; /* 8 */ /* NB. IN/OUT variable. */
- MEMORY_PADDING;
- memory_t tot_pages; /* 16 */
- MEMORY_PADDING;
- memory_t max_pages; /* 24 */
- MEMORY_PADDING;
- memory_t shared_info_frame; /* 32: MFN of shared_info struct */
- MEMORY_PADDING;
- u64 cpu_time; /* 40 */
-} PACKED dom0_getdomaininfo_t; /* 48 bytes */
-
-#define DOM0_BUILDDOMAIN 13
-typedef struct {
- /* IN variables. */
- domid_t domain; /* 0 */
- u16 __pad0; /* 2 */
- u32 __pad1; /* 4 */
- /* IN/OUT parameters */
- full_execution_context_t *ctxt; /* 8 */
- MEMORY_PADDING;
-} PACKED dom0_builddomain_t; /* 16 bytes */
-
-#define DOM0_IOPL 14
-typedef struct {
- domid_t domain; /* 0 */
- u16 __pad;
- u32 iopl; /* 4 */
-} PACKED dom0_iopl_t; /* 8 bytes */
-
-#define DOM0_MSR 15
-typedef struct {
- /* IN variables. */
- u32 write; /* 0 */
- u32 cpu_mask; /* 4 */
- u32 msr; /* 8 */
- u32 in1; /* 12 */
- u32 in2; /* 16 */
- /* OUT variables. */
- u32 out1; /* 20 */
- u32 out2; /* 24 */
-} PACKED dom0_msr_t; /* 28 bytes */
-
-#define DOM0_DEBUG 16
-typedef struct {
- /* IN variables. */
- domid_t domain; /* 0 */
- u8 opcode; /* 2 */
- u8 __pad;
- u32 in1; /* 4 */
- u32 in2; /* 8 */
- u32 in3; /* 12 */
- u32 in4; /* 16 */
- /* OUT variables. */
- u32 status; /* 20 */
- u32 out1; /* 24 */
- u32 out2; /* 28 */
-} PACKED dom0_debug_t; /* 32 bytes */
-
-/*
- * Set clock such that it would read <secs,usecs> after 00:00:00 UTC,
- * 1 January, 1970 if the current system time was <system_time>.
- */
-#define DOM0_SETTIME 17
-typedef struct {
- /* IN variables. */
- u32 secs; /* 0 */
- u32 usecs; /* 4 */
- u64 system_time; /* 8 */
-} PACKED dom0_settime_t; /* 16 bytes */
-
-#define DOM0_GETPAGEFRAMEINFO 18
-#define NOTAB 0 /* normal page */
-#define L1TAB (1<<28)
-#define L2TAB (2<<28)
-#define L3TAB (3<<28)
-#define L4TAB (4<<28)
-#define LPINTAB (1<<31)
-#define XTAB (0xf<<28) /* invalid page */
-#define LTAB_MASK XTAB
-#define LTABTYPE_MASK (0x7<<28)
-
-typedef struct {
- /* IN variables. */
- memory_t pfn; /* 0: Machine page frame number to query. */
- MEMORY_PADDING;
- domid_t domain; /* 8: To which domain does the frame belong? */
- u16 __pad;
- /* OUT variables. */
- /* Is the page PINNED to a type? */
- u32 type; /* 12: see above type defs */
-} PACKED dom0_getpageframeinfo_t; /* 16 bytes */
-
-/*
- * Read console content from Xen buffer ring.
- */
-#define DOM0_READCONSOLE 19
-typedef struct {
- memory_t str; /* 0 */
- MEMORY_PADDING;
- u32 count; /* 8 */
- u32 cmd; /* 12 */
-} PACKED dom0_readconsole_t; /* 16 bytes */
-
-/*
- * Pin Domain to a particular CPU (use -1 to unpin)
- */
-#define DOM0_PINCPUDOMAIN 20
-typedef struct {
- /* IN variables. */
- domid_t domain; /* 0 */
- u16 __pad;
- s32 cpu; /* 4: -1 implies unpin */
-} PACKED dom0_pincpudomain_t; /* 8 bytes */
-
-/* Get trace buffers machine base address */
-#define DOM0_GETTBUFS 21
-typedef struct {
- /* OUT variables */
- memory_t mach_addr; /* 0: location of the trace buffers */
- MEMORY_PADDING;
- u32 size; /* 8: size of each trace buffer, in bytes */
-} PACKED dom0_gettbufs_t; /* 12 bytes */
-
-/*
- * Get physical information about the host machine
- */
-#define DOM0_PHYSINFO 22
-typedef struct {
- u32 ht_per_core; /* 0 */
- u32 cores; /* 4 */
- u32 cpu_khz; /* 8 */
- u32 __pad; /* 12 */
- memory_t total_pages; /* 16 */
- MEMORY_PADDING;
- memory_t free_pages; /* 24 */
- MEMORY_PADDING;
-} PACKED dom0_physinfo_t; /* 32 bytes */
-
-/*
- * Allow a domain access to a physical PCI device
- */
-#define DOM0_PCIDEV_ACCESS 23
-typedef struct {
- /* IN variables. */
- domid_t domain; /* 0 */
- u16 __pad;
- u32 bus; /* 4 */
- u32 dev; /* 8 */
- u32 func; /* 12 */
- u32 enable; /* 16 */
-} PACKED dom0_pcidev_access_t; /* 20 bytes */
-
-/*
- * Get the ID of the current scheduler.
- */
-#define DOM0_SCHED_ID 24
-typedef struct {
- /* OUT variable */
- u32 sched_id; /* 0 */
-} PACKED dom0_sched_id_t; /* 4 bytes */
-
-/*
- * Control shadow pagetables operation
- */
-#define DOM0_SHADOW_CONTROL 25
-
-#define DOM0_SHADOW_CONTROL_OP_OFF 0
-#define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST 1
-#define DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY 2
-#define DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE 3
-#define DOM0_SHADOW_CONTROL_OP_FLUSH 10 /* table ops */
-#define DOM0_SHADOW_CONTROL_OP_CLEAN 11
-#define DOM0_SHADOW_CONTROL_OP_PEEK 12
-
-typedef struct dom0_shadow_control
-{
- u32 fault_count;
- u32 dirty_count;
- u32 dirty_net_count;
- u32 dirty_block_count;
-} dom0_shadow_control_stats_t;
-
-typedef struct {
- /* IN variables. */
- domid_t domain; /* 0 */
- u16 __pad;
- u32 op; /* 4 */
- unsigned long *dirty_bitmap; /* 8: pointer to locked buffer */
- MEMORY_PADDING;
- /* IN/OUT variables. */
- memory_t pages; /* 16: size of buffer, updated with actual size */
- MEMORY_PADDING;
- /* OUT variables. */
- dom0_shadow_control_stats_t stats;
-} PACKED dom0_shadow_control_t;
-
-#define DOM0_SETDOMAININITIALMEM 27
-typedef struct {
- /* IN variables. */
- domid_t domain; /* 0 */
- u16 __pad0;
- u32 __pad1;
- memory_t initial_memkb; /* 8 */
- MEMORY_PADDING;
-} PACKED dom0_setdomaininitialmem_t; /* 16 bytes */
-
-#define DOM0_SETDOMAINMAXMEM 28
-typedef struct {
- /* IN variables. */
- domid_t domain; /* 0 */
- u16 __pad0;
- u32 __pad1;
- memory_t max_memkb; /* 8 */
- MEMORY_PADDING;
-} PACKED dom0_setdomainmaxmem_t; /* 16 bytes */
-
-#define DOM0_GETPAGEFRAMEINFO2 29 /* batched interface */
-typedef struct {
- /* IN variables. */
- domid_t domain; /* 0 */
- u16 __pad0;
- u32 __pad1;
- memory_t num; /* 8 */
- MEMORY_PADDING;
- /* IN/OUT variables. */
- unsigned long *array; /* 16 */
- MEMORY_PADDING;
-} PACKED dom0_getpageframeinfo2_t; /* 24 bytes */
-
-#define DOM0_SETDOMAINVMASSIST 30
-typedef struct {
- /* IN variables. */
- domid_t domain; /* 0 */
- u16 __pad0;
- u32 cmd; /* 4: vm_assist cmd */
- u32 type; /* 8: vm_assist cmd */
-} PACKED dom0_setdomainvmassist_t; /* 12 bytes */
-
-typedef struct {
- u32 cmd; /* 0 */
- u32 interface_version; /* 4 */ /* DOM0_INTERFACE_VERSION */
- union { /* 8 */
- u32 dummy[18]; /* 72 bytes */
- dom0_createdomain_t createdomain;
- dom0_pausedomain_t pausedomain;
- dom0_unpausedomain_t unpausedomain;
- dom0_destroydomain_t destroydomain;
- dom0_getmemlist_t getmemlist;
- dom0_schedctl_t schedctl;
- dom0_adjustdom_t adjustdom;
- dom0_builddomain_t builddomain;
- dom0_getdomaininfo_t getdomaininfo;
- dom0_getpageframeinfo_t getpageframeinfo;
- dom0_iopl_t iopl;
- dom0_msr_t msr;
- dom0_debug_t debug;
- dom0_settime_t settime;
- dom0_readconsole_t readconsole;
- dom0_pincpudomain_t pincpudomain;
- dom0_gettbufs_t gettbufs;
- dom0_physinfo_t physinfo;
- dom0_pcidev_access_t pcidev_access;
- dom0_sched_id_t sched_id;
- dom0_shadow_control_t shadow_control;
- dom0_setdomaininitialmem_t setdomaininitialmem;
- dom0_setdomainmaxmem_t setdomainmaxmem;
- dom0_getpageframeinfo2_t getpageframeinfo2;
- dom0_setdomainvmassist_t setdomainvmassist;
- } PACKED u;
-} PACKED dom0_op_t; /* 80 bytes */
-
-#endif /* __DOM0_OPS_H__ */
+++ /dev/null
-/******************************************************************************
- * event_channel.h
- *
- * Event channels between domains.
- *
- * Copyright (c) 2003-2004, K A Fraser.
- */
-
-#ifndef __HYPERVISOR_IFS__EVENT_CHANNEL_H__
-#define __HYPERVISOR_IFS__EVENT_CHANNEL_H__
-
-/*
- * EVTCHNOP_alloc_unbound: Allocate a fresh local port and prepare
- * it for binding to <dom>.
- */
-#define EVTCHNOP_alloc_unbound 6
-typedef struct {
- /* IN parameters */
- domid_t dom; /* 0 */
- u16 __pad;
- /* OUT parameters */
- u32 port; /* 4 */
-} PACKED evtchn_alloc_unbound_t; /* 8 bytes */
-
-/*
- * EVTCHNOP_bind_interdomain: Construct an interdomain event channel between
- * <dom1> and <dom2>. Either <port1> or <port2> may be wildcarded by setting to
- * zero. On successful return both <port1> and <port2> are filled in and
- * <dom1,port1> is fully bound to <dom2,port2>.
- *
- * NOTES:
- * 1. A wildcarded port is allocated from the relevant domain's free list
- * (i.e., some port that was previously EVTCHNSTAT_closed). However, if the
- * remote port pair is already fully bound then a port is not allocated,
- * and instead the existing local port is returned to the caller.
- * 2. If the caller is unprivileged then <dom1> must be DOMID_SELF.
- * 3. If the caller is unprivileged and <dom2,port2> is EVTCHNSTAT_closed
- * then <dom2> must be DOMID_SELF.
- * 4. If either port is already bound then it must be bound to the other
- * specified domain and port (if not wildcarded).
- * 5. If either port is awaiting binding (EVTCHNSTAT_unbound) then it must
- * be awaiting binding to the other domain, and the other port pair must
- * be closed or unbound.
- */
-#define EVTCHNOP_bind_interdomain 0
-typedef struct {
- /* IN parameters. */
- domid_t dom1, dom2; /* 0, 2 */
- /* IN/OUT parameters. */
- u32 port1, port2; /* 4, 8 */
-} PACKED evtchn_bind_interdomain_t; /* 12 bytes */
-
-/*
- * EVTCHNOP_bind_virq: Bind a local event channel to IRQ <irq>.
- * NOTES:
- * 1. A virtual IRQ may be bound to at most one event channel per domain.
- */
-#define EVTCHNOP_bind_virq 1
-typedef struct {
- /* IN parameters. */
- u32 virq; /* 0 */
- /* OUT parameters. */
- u32 port; /* 4 */
-} PACKED evtchn_bind_virq_t; /* 8 bytes */
-
-/*
- * EVTCHNOP_bind_pirq: Bind a local event channel to IRQ <irq>.
- * NOTES:
- * 1. A physical IRQ may be bound to at most one event channel per domain.
- * 2. Only a sufficiently-privileged domain may bind to a physical IRQ.
- */
-#define EVTCHNOP_bind_pirq 2
-typedef struct {
- /* IN parameters. */
- u32 pirq; /* 0 */
-#define BIND_PIRQ__WILL_SHARE 1
- u32 flags; /* BIND_PIRQ__* */ /* 4 */
- /* OUT parameters. */
- u32 port; /* 8 */
-} PACKED evtchn_bind_pirq_t; /* 12 bytes */
-
-/*
- * EVTCHNOP_close: Close the communication channel which has an endpoint at
- * <dom, port>. If the channel is interdomain then the remote end is placed in
- * the unbound state (EVTCHNSTAT_unbound), awaiting a new connection.
- * NOTES:
- * 1. <dom> may be specified as DOMID_SELF.
- * 2. Only a sufficiently-privileged domain may close an event channel
- * for which <dom> is not DOMID_SELF.
- */
-#define EVTCHNOP_close 3
-typedef struct {
- /* IN parameters. */
- domid_t dom; /* 0 */
- u16 __pad;
- u32 port; /* 4 */
- /* No OUT parameters. */
-} PACKED evtchn_close_t; /* 8 bytes */
-
-/*
- * EVTCHNOP_send: Send an event to the remote end of the channel whose local
- * endpoint is <DOMID_SELF, local_port>.
- */
-#define EVTCHNOP_send 4
-typedef struct {
- /* IN parameters. */
- u32 local_port; /* 0 */
- /* No OUT parameters. */
-} PACKED evtchn_send_t; /* 4 bytes */
-
-/*
- * EVTCHNOP_status: Get the current status of the communication channel which
- * has an endpoint at <dom, port>.
- * NOTES:
- * 1. <dom> may be specified as DOMID_SELF.
- * 2. Only a sufficiently-privileged domain may obtain the status of an event
- * channel for which <dom> is not DOMID_SELF.
- */
-#define EVTCHNOP_status 5
-typedef struct {
- /* IN parameters */
- domid_t dom; /* 0 */
- u16 __pad;
- u32 port; /* 4 */
- /* OUT parameters */
-#define EVTCHNSTAT_closed 0 /* Channel is not in use. */
-#define EVTCHNSTAT_unbound 1 /* Channel is waiting interdom connection.*/
-#define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
-#define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
-#define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
- u32 status; /* 8 */
- union { /* 12 */
- struct {
- domid_t dom; /* 12 */
- } PACKED unbound; /* EVTCHNSTAT_unbound */
- struct {
- domid_t dom; /* 12 */
- u16 __pad;
- u32 port; /* 16 */
- } PACKED interdomain; /* EVTCHNSTAT_interdomain */
- u32 pirq; /* EVTCHNSTAT_pirq */ /* 12 */
- u32 virq; /* EVTCHNSTAT_virq */ /* 12 */
- } PACKED u;
-} PACKED evtchn_status_t; /* 20 bytes */
-
-typedef struct {
- u32 cmd; /* EVTCHNOP_* */ /* 0 */
- u32 __reserved; /* 4 */
- union { /* 8 */
- evtchn_alloc_unbound_t alloc_unbound;
- evtchn_bind_interdomain_t bind_interdomain;
- evtchn_bind_virq_t bind_virq;
- evtchn_bind_pirq_t bind_pirq;
- evtchn_close_t close;
- evtchn_send_t send;
- evtchn_status_t status;
- u8 __dummy[24];
- } PACKED u;
-} PACKED evtchn_op_t; /* 32 bytes */
-
-#endif /* __HYPERVISOR_IFS__EVENT_CHANNEL_H__ */
+++ /dev/null
-/******************************************************************************
- * grant_table.h
- *
- * Interface for granting foreign access to page frames, and receiving
- * page-ownership transfers.
- *
- * Copyright (c) 2004, K A Fraser
- */
-
-#ifndef __HYPERVISOR_IFS_GRANT_TABLE_H__
-#define __HYPERVISOR_IFS_GRANT_TABLE_H__
-
-
-/***********************************
- * GRANT TABLE REPRESENTATION
- */
-
-/* Some rough guidelines on accessing and updating grant-table entries
- * in a concurrency-safe manner. For more information, Linux contains a
- * reference implementation for guest OSes (arch/xen/kernel/grant_table.c).
- *
- * NB. WMB is a no-op on current-generation x86 processors. However, a
- * compiler barrier will still be required.
- *
- * Introducing a valid entry into the grant table:
- * 1. Write ent->domid.
- * 2. Write ent->frame:
- * GTF_permit_access: Frame to which access is permitted.
- * GTF_accept_transfer: Pseudo-phys frame slot being filled by new
- * frame, or zero if none.
- * 3. Write memory barrier (WMB).
- * 4. Write ent->flags, inc. valid type.
- *
- * Invalidating an unused GTF_permit_access entry:
- * 1. flags = ent->flags.
- * 2. Observe that !(flags & (GTF_reading|GTF_writing)).
- * 3. Check result of SMP-safe CMPXCHG(&ent->flags, flags, 0).
- * NB. No need for WMB as reuse of entry is control-dependent on success of
- * step 3, and all architectures guarantee ordering of ctrl-dep writes.
- *
- * Invalidating an in-use GTF_permit_access entry:
- * This cannot be done directly. Request assistance from the domain controller
- * which can set a timeout on the use of a grant entry and take necessary
- * action. (NB. This is not yet implemented!).
- *
- * Invalidating an unused GTF_accept_transfer entry:
- * 1. flags = ent->flags.
- * 2. Observe that !(flags & GTF_transfer_committed). [*]
- * 3. Check result of SMP-safe CMPXCHG(&ent->flags, flags, 0).
- * NB. No need for WMB as reuse of entry is control-dependent on success of
- * step 3, and all architectures guarantee ordering of ctrl-dep writes.
- * [*] If GTF_transfer_committed is set then the grant entry is 'committed'.
- * The guest must /not/ modify the grant entry until the address of the
- * transferred frame is written. It is safe for the guest to spin waiting
- * for this to occur (detect by observing GTF_transfer_completed in
- * ent->flags).
- *
- * Invalidating a committed GTF_accept_transfer entry:
- * 1. Wait for (ent->flags & GTF_transfer_completed).
- *
- * Changing a GTF_permit_access from writable to read-only:
- * Use SMP-safe CMPXCHG to set GTF_readonly, while checking !GTF_writing.
- *
- * Changing a GTF_permit_access from read-only to writable:
- * Use SMP-safe bit-setting instruction.
- */
-
-/*
- * A grant table comprises a packed array of grant entries in one or more
- * page frames shared between Xen and a guest.
- * [XEN]: This field is written by Xen and read by the sharing guest.
- * [GST]: This field is written by the guest and read by Xen.
- */
-typedef struct {
- /* GTF_xxx: various type and flag information. [XEN,GST] */
- u16 flags; /* 0 */
- /* The domain being granted foreign privileges. [GST] */
- domid_t domid; /* 2 */
- /*
- * GTF_permit_access: Frame that @domid is allowed to map and access. [GST]
- * GTF_accept_transfer: Frame whose ownership transferred by @domid. [XEN]
- */
- u32 frame; /* 4 */
-} PACKED grant_entry_t; /* 8 bytes */
-
-/*
- * Type of grant entry.
- * GTF_invalid: This grant entry grants no privileges.
- * GTF_permit_access: Allow @domid to map/access @frame.
- * GTF_accept_transfer: Allow @domid to transfer ownership of one page frame
- * to this guest. Xen writes the page number to @frame.
- */
-#define GTF_invalid (0U<<0)
-#define GTF_permit_access (1U<<0)
-#define GTF_accept_transfer (2U<<0)
-#define GTF_type_mask (3U<<0)
-
-/*
- * Subflags for GTF_permit_access.
- * GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST]
- * GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN]
- * GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN]
- */
-#define _GTF_readonly (2)
-#define GTF_readonly (1U<<_GTF_readonly)
-#define _GTF_reading (3)
-#define GTF_reading (1U<<_GTF_reading)
-#define _GTF_writing (4)
-#define GTF_writing (1U<<_GTF_writing)
-
-/*
- * Subflags for GTF_accept_transfer:
- * GTF_transfer_committed: Xen sets this flag to indicate that it is committed
- * to transferring ownership of a page frame. When a guest sees this flag
- * it must /not/ modify the grant entry until GTF_transfer_completed is
- * set by Xen.
- * GTF_transfer_completed: It is safe for the guest to spin-wait on this flag
- * after reading GTF_transfer_committed. Xen will always write the frame
- * address, followed by ORing this flag, in a timely manner.
- */
-#define _GTF_transfer_committed (2)
-#define GTF_transfer_committed (1U<<_GTF_transfer_committed)
-#define _GTF_transfer_completed (3)
-#define GTF_transfer_completed (1U<<_GTF_transfer_completed)
-
-
-/***********************************
- * GRANT TABLE QUERIES AND USES
- */
-
-/*
- * Reference to a grant entry in a specified domain's grant table.
- */
-typedef u16 grant_ref_t;
-
-/*
- * GNTTABOP_map_grant_ref: Map the grant entry (<dom>,<ref>) for access
- * by devices and/or host CPUs. If successful, <handle> is a tracking number
- * that must be presented later to destroy the mapping(s). On error, <handle>
- * is a negative status code.
- * NOTES:
- * 1. If GNTPIN_map_for_dev is specified then <dev_bus_addr> is the address
- * via which I/O devices may access the granted frame.
- * 2. If GNTPIN_map_for_host is specified then a mapping will be added at
- * virtual address <host_virt_addr> in the current address space.
- * 3. Mappings should only be destroyed via GNTTABOP_unmap_grant_ref. If a
- * host mapping is destroyed by other means then it is *NOT* guaranteed
- * to be accounted to the correct grant reference!
- */
-#define GNTTABOP_map_grant_ref 0
-typedef struct {
- /* IN parameters. */
- memory_t host_virt_addr; /* 0 */
- MEMORY_PADDING;
- domid_t dom; /* 8 */
- grant_ref_t ref; /* 10 */
- u16 flags; /* 12: GNTMAP_* */
- /* OUT parameters. */
- s16 handle; /* 14: +ve: handle; -ve: GNTST_* */
- memory_t dev_bus_addr; /* 16 */
- MEMORY_PADDING;
-} PACKED gnttab_map_grant_ref_t; /* 24 bytes */
-
-/*
- * GNTTABOP_unmap_grant_ref: Destroy one or more grant-reference mappings
- * tracked by <handle>. If <host_virt_addr> or <dev_bus_addr> is zero, that
- * field is ignored. If non-zero, they must refer to a device/host mapping
- * that is tracked by <handle>
- * NOTES:
- * 1. The call may fail in an undefined manner if either mapping is not
- * tracked by <handle>.
- * 3. After executing a batch of unmaps, it is guaranteed that no stale
- * mappings will remain in the device or host TLBs.
- */
-#define GNTTABOP_unmap_grant_ref 1
-typedef struct {
- /* IN parameters. */
- memory_t host_virt_addr; /* 0 */
- MEMORY_PADDING;
- memory_t dev_bus_addr; /* 8 */
- MEMORY_PADDING;
- u16 handle; /* 16 */
- /* OUT parameters. */
- s16 status; /* 18: GNTST_* */
- u32 __pad;
-} PACKED gnttab_unmap_grant_ref_t; /* 24 bytes */
-
-/*
- * GNTTABOP_setup_table: Set up a grant table for <dom> comprising at least
- * <nr_frames> pages. The frame addresses are written to the <frame_list>.
- * Only <nr_frames> addresses are written, even if the table is larger.
- * NOTES:
- * 1. <dom> may be specified as DOMID_SELF.
- * 2. Only a sufficiently-privileged domain may specify <dom> != DOMID_SELF.
- * 3. Xen may not support more than a single grant-table page per domain.
- */
-#define GNTTABOP_setup_table 2
-typedef struct {
- /* IN parameters. */
- domid_t dom; /* 0 */
- u16 nr_frames; /* 2 */
- u16 __pad;
- /* OUT parameters. */
- s16 status; /* 6: GNTST_* */
- unsigned long *frame_list; /* 8 */
- MEMORY_PADDING;
-} PACKED gnttab_setup_table_t; /* 16 bytes */
-
-/*
- * Bitfield values for update_pin_status.flags.
- */
- /* Map the grant entry for access by I/O devices. */
-#define _GNTMAP_device_map (0)
-#define GNTMAP_device_map (1<<_GNTMAP_device_map)
- /* Map the grant entry for access by host CPUs. */
-#define _GNTMAP_host_map (1)
-#define GNTMAP_host_map (1<<_GNTMAP_host_map)
- /* Accesses to the granted frame will be restricted to read-only access. */
-#define _GNTMAP_readonly (2)
-#define GNTMAP_readonly (1<<_GNTMAP_readonly)
- /*
- * GNTMAP_host_map subflag:
- * 0 => The host mapping is usable only by the guest OS.
- * 1 => The host mapping is usable by guest OS + current application.
- */
-#define _GNTMAP_application_map (3)
-#define GNTMAP_application_map (1<<_GNTMAP_application_map)
-
-/*
- * Values for error status returns. All errors are -ve.
- */
-#define GNTST_okay (0)
-#define GNTST_general_error (-1) /* General undefined error. */
-#define GNTST_bad_domain (-2) /* Unrecognsed domain id. */
-#define GNTST_bad_gntref (-3) /* Unrecognised or inappropriate gntref. */
-#define GNTST_bad_handle (-3) /* Unrecognised or inappropriate handle. */
-#define GNTST_no_device_space (-4) /* Out of space in I/O MMU. */
-#define GNTST_permission_denied (-5) /* Not enough privilege for operation. */
-
-#define GNTTABOP_error_msgs { \
- "okay", \
- "undefined error", \
- "unrecognised domain id", \
- "invalid grant reference", \
- "invalid mapping handle", \
- "no spare translation slot in the I/O MMU", \
- "permission denied" \
-}
-
-
-#endif /* __HYPERVISOR_IFS_GRANT_TABLE_H__ */
+++ /dev/null
-/******************************************************************************
- * hypervisor-if.h
- *
- * Guest OS interface to Xen.
- *
- * Copyright (c) 2004, K A Fraser
- */
-
-#ifndef __HYPERVISOR_IF_H__
-#define __HYPERVISOR_IF_H__
-
-/* GCC-specific way to pack structure definitions (no implicit padding). */
-#define PACKED __attribute__ ((packed))
-
-#if defined(__i386__)
-#include "arch-x86_32.h"
-#elif defined(__x86_64__)
-#include "arch-x86_64.h"
-#else
-#error "Unsupported architecture"
-#endif
-
-/*
- * HYPERVISOR "SYSTEM CALLS"
- */
-
-/* EAX = vector; EBX, ECX, EDX, ESI, EDI = args 1, 2, 3, 4, 5. */
-#define __HYPERVISOR_set_trap_table 0
-#define __HYPERVISOR_mmu_update 1
-#define __HYPERVISOR_set_gdt 2
-#define __HYPERVISOR_stack_switch 3
-#define __HYPERVISOR_set_callbacks 4
-#define __HYPERVISOR_fpu_taskswitch 5
-#define __HYPERVISOR_sched_op 6
-#define __HYPERVISOR_dom0_op 7
-#define __HYPERVISOR_set_debugreg 8
-#define __HYPERVISOR_get_debugreg 9
-#define __HYPERVISOR_update_descriptor 10
-#define __HYPERVISOR_set_fast_trap 11
-#define __HYPERVISOR_dom_mem_op 12
-#define __HYPERVISOR_multicall 13
-#define __HYPERVISOR_update_va_mapping 14
-#define __HYPERVISOR_set_timer_op 15
-#define __HYPERVISOR_event_channel_op 16
-#define __HYPERVISOR_xen_version 17
-#define __HYPERVISOR_console_io 18
-#define __HYPERVISOR_physdev_op 19
-#define __HYPERVISOR_grant_table_op 20
-#define __HYPERVISOR_vm_assist 21
-#define __HYPERVISOR_update_va_mapping_otherdomain 22
-
-/*
- * MULTICALLS
- *
- * Multicalls are listed in an array, with each element being a fixed size
- * (BYTES_PER_MULTICALL_ENTRY). Each is of the form (op, arg1, ..., argN)
- * where each element of the tuple is a machine word.
- */
-#define ARGS_PER_MULTICALL_ENTRY 8
-
-
-/*
- * VIRTUAL INTERRUPTS
- *
- * Virtual interrupts that a guest OS may receive from the hypervisor.
- */
-#define VIRQ_MISDIRECT 0 /* Catch-all interrupt for unbound VIRQs. */
-#define VIRQ_TIMER 1 /* Timebase update, and/or requested timeout. */
-#define VIRQ_DEBUG 2 /* Request guest to dump debug info. */
-#define VIRQ_CONSOLE 3 /* (DOM0) bytes received on emergency console. */
-#define VIRQ_DOM_EXC 4 /* (DOM0) Exceptional event for some domain. */
-#define VIRQ_PARITY_ERR 5 /* (DOM0) NMI parity error. */
-#define VIRQ_IO_ERR 6 /* (DOM0) NMI I/O error. */
-#define NR_VIRQS 7
-
-/*
- * MMU-UPDATE REQUESTS
- *
- * HYPERVISOR_mmu_update() accepts a list of (ptr, val) pairs.
- * ptr[1:0] specifies the appropriate MMU_* command.
- *
- * FOREIGN DOMAIN (FD)
- * -------------------
- * Some commands recognise an explicitly-declared foreign domain,
- * in which case they will operate with respect to the foreigner rather than
- * the calling domain. Where the FD has some effect, it is described below.
- *
- * ptr[1:0] == MMU_NORMAL_PT_UPDATE:
- * Updates an entry in a page table. If updating an L1 table, and the new
- * table entry is valid/present, the mapped frame must belong to the FD, if
- * an FD has been specified. If attempting to map an I/O page then the
- * caller assumes the privilege of the FD.
- * FD == DOMID_IO: Permit /only/ I/O mappings, at the priv level of the caller.
- * FD == DOMID_XEN: Map restricted areas of Xen's heap space.
- * ptr[:2] -- Machine address of the page-table entry to modify.
- * val -- Value to write.
- *
- * ptr[1:0] == MMU_MACHPHYS_UPDATE:
- * Updates an entry in the machine->pseudo-physical mapping table.
- * ptr[:2] -- Machine address within the frame whose mapping to modify.
- * The frame must belong to the FD, if one is specified.
- * val -- Value to write into the mapping entry.
- *
- * ptr[1:0] == MMU_EXTENDED_COMMAND:
- * val[7:0] -- MMUEXT_* command.
- *
- * val[7:0] == MMUEXT_(UN)PIN_*_TABLE:
- * ptr[:2] -- Machine address of frame to be (un)pinned as a p.t. page.
- * The frame must belong to the FD, if one is specified.
- *
- * val[7:0] == MMUEXT_NEW_BASEPTR:
- * ptr[:2] -- Machine address of new page-table base to install in MMU.
- *
- * val[7:0] == MMUEXT_TLB_FLUSH:
- * No additional arguments.
- *
- * val[7:0] == MMUEXT_INVLPG:
- * ptr[:2] -- Linear address to be flushed from the TLB.
- *
- * val[7:0] == MMUEXT_FLUSH_CACHE:
- * No additional arguments. Writes back and flushes cache contents.
- *
- * val[7:0] == MMUEXT_SET_LDT:
- * ptr[:2] -- Linear address of LDT base (NB. must be page-aligned).
- * val[:8] -- Number of entries in LDT.
- *
- * val[7:0] == MMUEXT_TRANSFER_PAGE:
- * val[31:16] -- Domain to whom page is to be transferred.
- * (val[15:8],ptr[9:2]) -- 16-bit reference into transferee's grant table.
- * ptr[:12] -- Page frame to be reassigned to the FD.
- * (NB. The frame must currently belong to the calling domain).
- *
- * val[7:0] == MMUEXT_SET_FOREIGNDOM:
- * val[31:16] -- Domain to set as the Foreign Domain (FD).
- * (NB. DOMID_SELF is not recognised)
- * If FD != DOMID_IO then the caller must be privileged.
- *
- * val[7:0] == MMUEXT_CLEAR_FOREIGNDOM:
- * Clears the FD.
- *
- * val[7:0] == MMUEXT_REASSIGN_PAGE:
- * ptr[:2] -- A machine address within the page to be reassigned to the FD.
- * (NB. page must currently belong to the calling domain).
- */
-#define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */
-#define MMU_MACHPHYS_UPDATE 2 /* ptr = MA of frame to modify entry for */
-#define MMU_EXTENDED_COMMAND 3 /* least 8 bits of val demux further */
-#define MMUEXT_PIN_L1_TABLE 0 /* ptr = MA of frame to pin */
-#define MMUEXT_PIN_L2_TABLE 1 /* ptr = MA of frame to pin */
-#define MMUEXT_PIN_L3_TABLE 2 /* ptr = MA of frame to pin */
-#define MMUEXT_PIN_L4_TABLE 3 /* ptr = MA of frame to pin */
-#define MMUEXT_UNPIN_TABLE 4 /* ptr = MA of frame to unpin */
-#define MMUEXT_NEW_BASEPTR 5 /* ptr = MA of new pagetable base */
-#define MMUEXT_TLB_FLUSH 6 /* ptr = NULL */
-#define MMUEXT_INVLPG 7 /* ptr = VA to invalidate */
-#define MMUEXT_FLUSH_CACHE 8
-#define MMUEXT_SET_LDT 9 /* ptr = VA of table; val = # entries */
-#define MMUEXT_SET_FOREIGNDOM 10 /* val[31:16] = dom */
-#define MMUEXT_CLEAR_FOREIGNDOM 11
-#define MMUEXT_TRANSFER_PAGE 12 /* ptr = MA of frame; val[31:16] = dom */
-#define MMUEXT_REASSIGN_PAGE 13
-#define MMUEXT_CMD_MASK 255
-#define MMUEXT_CMD_SHIFT 8
-
-/* These are passed as 'flags' to update_va_mapping. They can be ORed. */
-#define UVMF_FLUSH_TLB 1 /* Flush entire TLB. */
-#define UVMF_INVLPG 2 /* Flush the VA mapping being updated. */
-
-
-/*
- * Commands to HYPERVISOR_sched_op().
- */
-#define SCHEDOP_yield 0 /* Give up the CPU voluntarily. */
-#define SCHEDOP_block 1 /* Block until an event is received. */
-#define SCHEDOP_shutdown 2 /* Stop executing this domain. */
-#define SCHEDOP_cmdmask 255 /* 8-bit command. */
-#define SCHEDOP_reasonshift 8 /* 8-bit reason code. (SCHEDOP_shutdown) */
-
-/*
- * Commands to HYPERVISOR_console_io().
- */
-#define CONSOLEIO_write 0
-#define CONSOLEIO_read 1
-
-/*
- * Commands to HYPERVISOR_dom_mem_op().
- */
-#define MEMOP_increase_reservation 0
-#define MEMOP_decrease_reservation 1
-
-/*
- * Commands to HYPERVISOR_vm_assist().
- */
-#define VMASST_CMD_enable 0
-#define VMASST_CMD_disable 1
-#define VMASST_TYPE_4gb_segments 0
-#define VMASST_TYPE_4gb_segments_notify 1
-#define VMASST_TYPE_writable_pagetables 2
-#define MAX_VMASST_TYPE 2
-
-#ifndef __ASSEMBLY__
-
-typedef u16 domid_t;
-
-/* Domain ids >= DOMID_FIRST_RESERVED cannot be used for ordinary domains. */
-#define DOMID_FIRST_RESERVED (0x7FF0U)
-
-/* DOMID_SELF is used in certain contexts to refer to oneself. */
-#define DOMID_SELF (0x7FF0U)
-
-/*
- * DOMID_IO is used to restrict page-table updates to mapping I/O memory.
- * Although no Foreign Domain need be specified to map I/O pages, DOMID_IO
- * is useful to ensure that no mappings to the OS's own heap are accidentally
- * installed. (e.g., in Linux this could cause havoc as reference counts
- * aren't adjusted on the I/O-mapping code path).
- * This only makes sense in MMUEXT_SET_FOREIGNDOM, but in that context can
- * be specified by any calling domain.
- */
-#define DOMID_IO (0x7FF1U)
-
-/*
- * DOMID_XEN is used to allow privileged domains to map restricted parts of
- * Xen's heap space (e.g., the machine_to_phys table).
- * This only makes sense in MMUEXT_SET_FOREIGNDOM, and is only permitted if
- * the caller is privileged.
- */
-#define DOMID_XEN (0x7FF2U)
-
-/*
- * Send an array of these to HYPERVISOR_mmu_update().
- * NB. The fields are natural pointer/address size for this architecture.
- */
-typedef struct
-{
- memory_t ptr; /* Machine address of PTE. */
- memory_t val; /* New contents of PTE. */
-} PACKED mmu_update_t;
-
-/*
- * Send an array of these to HYPERVISOR_multicall().
- * NB. The fields are natural register size for this architecture.
- */
-typedef struct
-{
- cpureg_t op;
- cpureg_t args[7];
-} PACKED multicall_entry_t;
-
-/* Event channel endpoints per domain. */
-#define NR_EVENT_CHANNELS 1024
-
-/* No support for multi-processor guests. */
-#define MAX_VIRT_CPUS 1
-
-/*
- * Xen/guestos shared data -- pointer provided in start_info.
- * NB. We expect that this struct is smaller than a page.
- */
-typedef struct shared_info_st
-{
- /*
- * Per-VCPU information goes here. This will be cleaned up more when Xen
- * actually supports multi-VCPU guests.
- */
- struct {
- /*
- * 'evtchn_upcall_pending' is written non-zero by Xen to indicate
- * a pending notification for a particular VCPU. It is then cleared
- * by the guest OS /before/ checking for pending work, thus avoiding
- * a set-and-check race. Note that the mask is only accessed by Xen
- * on the CPU that is currently hosting the VCPU. This means that the
- * pending and mask flags can be updated by the guest without special
- * synchronisation (i.e., no need for the x86 LOCK prefix).
- * This may seem suboptimal because if the pending flag is set by
- * a different CPU then an IPI may be scheduled even when the mask
- * is set. However, note:
- * 1. The task of 'interrupt holdoff' is covered by the per-event-
- * channel mask bits. A 'noisy' event that is continually being
- * triggered can be masked at source at this very precise
- * granularity.
- * 2. The main purpose of the per-VCPU mask is therefore to restrict
- * reentrant execution: whether for concurrency control, or to
- * prevent unbounded stack usage. Whatever the purpose, we expect
- * that the mask will be asserted only for short periods at a time,
- * and so the likelihood of a 'spurious' IPI is suitably small.
- * The mask is read before making an event upcall to the guest: a
- * non-zero mask therefore guarantees that the VCPU will not receive
- * an upcall activation. The mask is cleared when the VCPU requests
- * to block: this avoids wakeup-waiting races.
- */
- u8 evtchn_upcall_pending;
- u8 evtchn_upcall_mask;
- u8 pad0, pad1;
- } PACKED vcpu_data[MAX_VIRT_CPUS]; /* 0 */
-
- /*
- * A domain can have up to 1024 "event channels" on which it can send
- * and receive asynchronous event notifications. There are three classes
- * of event that are delivered by this mechanism:
- * 1. Bi-directional inter- and intra-domain connections. Domains must
- * arrange out-of-band to set up a connection (usually the setup
- * is initiated and organised by a privileged third party such as
- * software running in domain 0).
- * 2. Physical interrupts. A domain with suitable hardware-access
- * privileges can bind an event-channel port to a physical interrupt
- * source.
- * 3. Virtual interrupts ('events'). A domain can bind an event-channel
- * port to a virtual interrupt source, such as the virtual-timer
- * device or the emergency console.
- *
- * Event channels are addressed by a "port index" between 0 and 1023.
- * Each channel is associated with two bits of information:
- * 1. PENDING -- notifies the domain that there is a pending notification
- * to be processed. This bit is cleared by the guest.
- * 2. MASK -- if this bit is clear then a 0->1 transition of PENDING
- * will cause an asynchronous upcall to be scheduled. This bit is only
- * updated by the guest. It is read-only within Xen. If a channel
- * becomes pending while the channel is masked then the 'edge' is lost
- * (i.e., when the channel is unmasked, the guest must manually handle
- * pending notifications as no upcall will be scheduled by Xen).
- *
- * To expedite scanning of pending notifications, any 0->1 pending
- * transition on an unmasked channel causes a corresponding bit in a
- * 32-bit selector to be set. Each bit in the selector covers a 32-bit
- * word in the PENDING bitfield array.
- */
- u32 evtchn_pending[32]; /* 4 */
- u32 evtchn_pending_sel; /* 132 */
- u32 evtchn_mask[32]; /* 136 */
-
- /*
- * Time: The following abstractions are exposed: System Time, Clock Time,
- * Domain Virtual Time. Domains can access Cycle counter time directly.
- */
- u64 cpu_freq; /* 264: CPU frequency (Hz). */
-
- /*
- * The following values are updated periodically (and not necessarily
- * atomically!). The guest OS detects this because 'time_version1' is
- * incremented just before updating these values, and 'time_version2' is
- * incremented immediately after. See the Xen-specific Linux code for an
- * example of how to read these values safely (arch/xen/kernel/time.c).
- */
- u32 time_version1; /* 272 */
- u32 time_version2; /* 276 */
- tsc_timestamp_t tsc_timestamp; /* TSC at last update of time vals. */
- u64 system_time; /* Time, in nanosecs, since boot. */
- u32 wc_sec; /* Secs 00:00:00 UTC, Jan 1, 1970. */
- u32 wc_usec; /* Usecs 00:00:00 UTC, Jan 1, 1970. */
- u64 domain_time; /* Domain virtual time, in nanosecs. */
-
- /*
- * Timeout values:
- * Allow a domain to specify a timeout value in system time and
- * domain virtual time.
- */
- u64 wall_timeout; /* 312 */
- u64 domain_timeout; /* 320 */
-
- arch_shared_info_t arch;
-
-} PACKED shared_info_t;
-
-/*
- * Start-of-day memory layout for the initial domain (DOM0):
- * 1. The domain is started within contiguous virtual-memory region.
- * 2. The contiguous region begins and ends on an aligned 4MB boundary.
- * 3. The region start corresponds to the load address of the OS image.
- * If the load address is not 4MB aligned then the address is rounded down.
- * 4. This the order of bootstrap elements in the initial virtual region:
- * a. relocated kernel image
- * b. initial ram disk [mod_start, mod_len]
- * c. list of allocated page frames [mfn_list, nr_pages]
- * d. bootstrap page tables [pt_base, CR3 (x86)]
- * e. start_info_t structure [register ESI (x86)]
- * f. bootstrap stack [register ESP (x86)]
- * 5. Bootstrap elements are packed together, but each is 4kB-aligned.
- * 6. The initial ram disk may be omitted.
- * 7. The list of page frames forms a contiguous 'pseudo-physical' memory
- * layout for the domain. In particular, the bootstrap virtual-memory
- * region is a 1:1 mapping to the first section of the pseudo-physical map.
- * 8. All bootstrap elements are mapped read-writable for the guest OS. The
- * only exception is the bootstrap page table, which is mapped read-only.
- * 9. There is guaranteed to be at least 512kB padding after the final
- * bootstrap element. If necessary, the bootstrap virtual region is
- * extended by an extra 4MB to ensure this.
- */
-
-#define MAX_CMDLINE 256
-typedef struct {
- /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME. */
- memory_t nr_pages; /* 0: Total pages allocated to this domain. */
- _MEMORY_PADDING(A);
- memory_t shared_info; /* 8: MACHINE address of shared info struct.*/
- _MEMORY_PADDING(B);
- u32 flags; /* 16: SIF_xxx flags. */
- u16 domain_controller_evtchn; /* 20 */
- u16 __pad;
- /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME). */
- memory_t pt_base; /* 24: VIRTUAL address of page directory. */
- _MEMORY_PADDING(C);
- memory_t nr_pt_frames; /* 32: Number of bootstrap p.t. frames. */
- _MEMORY_PADDING(D);
- memory_t mfn_list; /* 40: VIRTUAL address of page-frame list. */
- _MEMORY_PADDING(E);
- memory_t mod_start; /* 48: VIRTUAL address of pre-loaded module. */
- _MEMORY_PADDING(F);
- memory_t mod_len; /* 56: Size (bytes) of pre-loaded module. */
- _MEMORY_PADDING(G);
- u8 cmd_line[MAX_CMDLINE]; /* 64 */
-} PACKED start_info_t; /* 320 bytes */
-
-/* These flags are passed in the 'flags' field of start_info_t. */
-#define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */
-#define SIF_INITDOMAIN (1<<1) /* Is this the initial control domain? */
-#define SIF_BLK_BE_DOMAIN (1<<4) /* Is this a block backend domain? */
-#define SIF_NET_BE_DOMAIN (1<<5) /* Is this a net backend domain? */
-
-/* For use in guest OSes. */
-extern shared_info_t *HYPERVISOR_shared_info;
-
-#endif /* !__ASSEMBLY__ */
-
-#endif /* __HYPERVISOR_IF_H__ */
+++ /dev/null
-/******************************************************************************
- * blkif.h
- *
- * Unified block-device I/O interface for Xen guest OSes.
- *
- * Copyright (c) 2003-2004, Keir Fraser
- */
-
-#ifndef __SHARED_BLKIF_H__
-#define __SHARED_BLKIF_H__
-
-#define blkif_vdev_t u16
-#define blkif_sector_t u64
-
-#define BLKIF_OP_READ 0
-#define BLKIF_OP_WRITE 1
-#define BLKIF_OP_PROBE 2
-
-/* NB. Ring size must be small enough for sizeof(blkif_ring_t) <= PAGE_SIZE. */
-#define BLKIF_RING_SIZE 64
-
-/*
- * Maximum scatter/gather segments per request.
- * This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE.
- * NB. This could be 12 if the ring indexes weren't stored in the same page.
- */
-#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
-
-typedef struct {
- u8 operation; /* 0: BLKIF_OP_??? */
- u8 nr_segments; /* 1: number of segments */
- blkif_vdev_t device; /* 2: only for read/write requests */
- unsigned long id; /* 4: private guest value, echoed in resp */
- blkif_sector_t sector_number; /* start sector idx on disk (r/w only) */
- /* @f_a_s[2:0]=last_sect ; @f_a_s[5:3]=first_sect ; @f_a_s[:12]=frame. */
- /* @first_sect: first sector in frame to transfer (inclusive). */
- /* @last_sect: last sector in frame to transfer (inclusive). */
- /* @frame: machine page frame number. */
- unsigned long frame_and_sects[BLKIF_MAX_SEGMENTS_PER_REQUEST];
-} PACKED blkif_request_t;
-
-#define blkif_first_sect(_fas) (((_fas)>>3)&7)
-#define blkif_last_sect(_fas) ((_fas)&7)
-
-typedef struct {
- unsigned long id; /* copied from request */
- u8 operation; /* copied from request */
- s16 status; /* BLKIF_RSP_??? */
-} PACKED blkif_response_t;
-
-#define BLKIF_RSP_ERROR -1 /* non-specific 'error' */
-#define BLKIF_RSP_OKAY 0 /* non-specific 'okay' */
-
-/*
- * We use a special capitalised type name because it is _essential_ that all
- * arithmetic on indexes is done on an integer type of the correct size.
- */
-typedef u32 BLKIF_RING_IDX;
-
-/*
- * Ring indexes are 'free running'. That is, they are not stored modulo the
- * size of the ring buffer. The following macro converts a free-running counter
- * into a value that can directly index a ring-buffer array.
- */
-#define MASK_BLKIF_IDX(_i) ((_i)&(BLKIF_RING_SIZE-1))
-
-typedef struct {
- BLKIF_RING_IDX req_prod; /* 0: Request producer. Updated by front-end. */
- BLKIF_RING_IDX resp_prod; /* 4: Response producer. Updated by back-end. */
- union { /* 8 */
- blkif_request_t req;
- blkif_response_t resp;
- } PACKED ring[BLKIF_RING_SIZE];
-} PACKED blkif_ring_t;
-
-
-/*
- * BLKIF_OP_PROBE:
- * The request format for a probe request is constrained as follows:
- * @operation == BLKIF_OP_PROBE
- * @nr_segments == size of probe buffer in pages
- * @device == unused (zero)
- * @id == any value (echoed in response message)
- * @sector_num == unused (zero)
- * @frame_and_sects == list of page-sized buffers.
- * (i.e., @first_sect == 0, @last_sect == 7).
- *
- * The response is a list of vdisk_t elements copied into the out-of-band
- * probe buffer. On success the response status field contains the number
- * of vdisk_t elements.
- */
-
-/* XXX SMH: Type values below are chosen to match ide_xxx in Linux ide.h. */
-#define VDISK_TYPE_FLOPPY 0x00
-#define VDISK_TYPE_TAPE 0x01
-#define VDISK_TYPE_CDROM 0x05
-#define VDISK_TYPE_OPTICAL 0x07
-#define VDISK_TYPE_DISK 0x20
-
-#define VDISK_TYPE_MASK 0x3F
-#define VDISK_TYPE(_x) ((_x) & VDISK_TYPE_MASK)
-
-/* The top two bits of the type field encode various flags. */
-#define VDISK_FLAG_RO 0x40
-#define VDISK_FLAG_VIRT 0x80
-#define VDISK_READONLY(_x) ((_x) & VDISK_FLAG_RO)
-#define VDISK_VIRTUAL(_x) ((_x) & VDISK_FLAG_VIRT)
-
-typedef struct {
- blkif_sector_t capacity; /* 0: Size in terms of 512-byte sectors. */
- blkif_vdev_t device; /* 8: Device number (opaque 16 bit value). */
- u16 info; /* 10: Device type and flags (VDISK_*). */
-} PACKED vdisk_t; /* 12 bytes */
-
-#endif /* __SHARED_BLKIF_H__ */
+++ /dev/null
-/******************************************************************************
- * domain_controller.h
- *
- * Interface to server controller (e.g., 'xend'). This header file defines the
- * interface that is shared with guest OSes.
- *
- * Copyright (c) 2004, K A Fraser
- */
-
-#ifndef __DOMAIN_CONTROLLER_H__
-#define __DOMAIN_CONTROLLER_H__
-
-
-/*
- * Reason codes for SCHEDOP_shutdown. These are opaque to Xen but may be
- * interpreted by control software to determine the appropriate action. These
- * are only really advisories: the controller can actually do as it likes.
- */
-#define SHUTDOWN_poweroff 0 /* Domain exited normally. Clean up and kill. */
-#define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */
-#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
-
-
-/*
- * CONTROLLER MESSAGING INTERFACE.
- */
-
-typedef struct {
- u8 type; /* 0: echoed in response */
- u8 subtype; /* 1: echoed in response */
- u8 id; /* 2: echoed in response */
- u8 length; /* 3: number of bytes in 'msg' */
- u8 msg[60]; /* 4: type-specific message data */
-} PACKED control_msg_t; /* 64 bytes */
-
-#define CONTROL_RING_SIZE 8
-typedef u32 CONTROL_RING_IDX;
-#define MASK_CONTROL_IDX(_i) ((_i)&(CONTROL_RING_SIZE-1))
-
-typedef struct {
- control_msg_t tx_ring[CONTROL_RING_SIZE]; /* 0: guest -> controller */
- control_msg_t rx_ring[CONTROL_RING_SIZE]; /* 512: controller -> guest */
- CONTROL_RING_IDX tx_req_prod, tx_resp_prod; /* 1024, 1028 */
- CONTROL_RING_IDX rx_req_prod, rx_resp_prod; /* 1032, 1036 */
-} PACKED control_if_t; /* 1040 bytes */
-
-/*
- * Top-level command types.
- */
-#define CMSG_CONSOLE 0 /* Console */
-#define CMSG_BLKIF_BE 1 /* Block-device backend */
-#define CMSG_BLKIF_FE 2 /* Block-device frontend */
-#define CMSG_NETIF_BE 3 /* Network-device backend */
-#define CMSG_NETIF_FE 4 /* Network-device frontend */
-#define CMSG_SHUTDOWN 6 /* Shutdown messages */
-#define CMSG_MEM_REQUEST 7 /* Memory reservation reqs */
-
-
-/******************************************************************************
- * CONSOLE DEFINITIONS
- */
-
-/*
- * Subtypes for console messages.
- */
-#define CMSG_CONSOLE_DATA 0
-
-
-/******************************************************************************
- * BLOCK-INTERFACE FRONTEND DEFINITIONS
- */
-
-/* Messages from domain controller to guest. */
-#define CMSG_BLKIF_FE_INTERFACE_STATUS 0
-
-/* Messages from guest to domain controller. */
-#define CMSG_BLKIF_FE_DRIVER_STATUS 32
-#define CMSG_BLKIF_FE_INTERFACE_CONNECT 33
-#define CMSG_BLKIF_FE_INTERFACE_DISCONNECT 34
-#define CMSG_BLKIF_FE_INTERFACE_QUERY 35
-
-/* These are used by both front-end and back-end drivers. */
-#define blkif_vdev_t u16
-#define blkif_pdev_t u16
-#define blkif_sector_t u64
-
-/*
- * CMSG_BLKIF_FE_INTERFACE_STATUS:
- * Notify a guest about a status change on one of its block interfaces.
- * If the interface is DESTROYED or DOWN then the interface is disconnected:
- * 1. The shared-memory frame is available for reuse.
- * 2. Any unacknowledged messages pending on the interface were dropped.
- */
-#define BLKIF_INTERFACE_STATUS_CLOSED 0 /* Interface doesn't exist. */
-#define BLKIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
-#define BLKIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
-#define BLKIF_INTERFACE_STATUS_CHANGED 3 /* A device has been added or removed. */
-typedef struct {
- u32 handle; /* 0 */
- u32 status; /* 4 */
- u16 evtchn; /* 8: (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
- domid_t domid; /* 10: status != BLKIF_INTERFACE_STATUS_DESTROYED */
-} PACKED blkif_fe_interface_status_t; /* 12 bytes */
-
-/*
- * CMSG_BLKIF_FE_DRIVER_STATUS:
- * Notify the domain controller that the front-end driver is DOWN or UP.
- * When the driver goes DOWN then the controller will send no more
- * status-change notifications.
- * If the driver goes DOWN while interfaces are still UP, the domain
- * will automatically take the interfaces DOWN.
- *
- * NB. The controller should not send an INTERFACE_STATUS_CHANGED message
- * for interfaces that are active when it receives an UP notification. We
- * expect that the frontend driver will query those interfaces itself.
- */
-#define BLKIF_DRIVER_STATUS_DOWN 0
-#define BLKIF_DRIVER_STATUS_UP 1
-typedef struct {
- /* IN */
- u32 status; /* 0: BLKIF_DRIVER_STATUS_??? */
- /* OUT */
- /* Driver should query interfaces [0..max_handle]. */
- u32 max_handle; /* 4 */
-} PACKED blkif_fe_driver_status_t; /* 8 bytes */
-
-/*
- * CMSG_BLKIF_FE_INTERFACE_CONNECT:
- * If successful, the domain controller will acknowledge with a
- * STATUS_CONNECTED message.
- */
-typedef struct {
- u32 handle; /* 0 */
- u32 __pad;
- memory_t shmem_frame; /* 8 */
- MEMORY_PADDING;
-} PACKED blkif_fe_interface_connect_t; /* 16 bytes */
-
-/*
- * CMSG_BLKIF_FE_INTERFACE_DISCONNECT:
- * If successful, the domain controller will acknowledge with a
- * STATUS_DISCONNECTED message.
- */
-typedef struct {
- u32 handle; /* 0 */
-} PACKED blkif_fe_interface_disconnect_t; /* 4 bytes */
-
-/*
- * CMSG_BLKIF_FE_INTERFACE_QUERY:
- */
-typedef struct {
- /* IN */
- u32 handle; /* 0 */
- /* OUT */
- u32 status; /* 4 */
- u16 evtchn; /* 8: (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
- domid_t domid; /* 10: status != BLKIF_INTERFACE_STATUS_DESTROYED */
-} PACKED blkif_fe_interface_query_t; /* 12 bytes */
-
-
-/******************************************************************************
- * BLOCK-INTERFACE BACKEND DEFINITIONS
- */
-
-/* Messages from domain controller. */
-#define CMSG_BLKIF_BE_CREATE 0 /* Create a new block-device interface. */
-#define CMSG_BLKIF_BE_DESTROY 1 /* Destroy a block-device interface. */
-#define CMSG_BLKIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
-#define CMSG_BLKIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
-#define CMSG_BLKIF_BE_VBD_CREATE 4 /* Create a new VBD for an interface. */
-#define CMSG_BLKIF_BE_VBD_DESTROY 5 /* Delete a VBD from an interface. */
-#define CMSG_BLKIF_BE_VBD_GROW 6 /* Append an extent to a given VBD. */
-#define CMSG_BLKIF_BE_VBD_SHRINK 7 /* Remove last extent from a given VBD. */
-
-/* Messages to domain controller. */
-#define CMSG_BLKIF_BE_DRIVER_STATUS 32
-
-/*
- * Message request/response definitions for block-device messages.
- */
-
-typedef struct {
- blkif_sector_t sector_start; /* 0 */
- blkif_sector_t sector_length; /* 8 */
- blkif_pdev_t device; /* 16 */
- u16 __pad; /* 18 */
-} PACKED blkif_extent_t; /* 20 bytes */
-
-/* Non-specific 'okay' return. */
-#define BLKIF_BE_STATUS_OKAY 0
-/* Non-specific 'error' return. */
-#define BLKIF_BE_STATUS_ERROR 1
-/* The following are specific error returns. */
-#define BLKIF_BE_STATUS_INTERFACE_EXISTS 2
-#define BLKIF_BE_STATUS_INTERFACE_NOT_FOUND 3
-#define BLKIF_BE_STATUS_INTERFACE_CONNECTED 4
-#define BLKIF_BE_STATUS_VBD_EXISTS 5
-#define BLKIF_BE_STATUS_VBD_NOT_FOUND 6
-#define BLKIF_BE_STATUS_OUT_OF_MEMORY 7
-#define BLKIF_BE_STATUS_EXTENT_NOT_FOUND 8
-#define BLKIF_BE_STATUS_MAPPING_ERROR 9
-
-/* This macro can be used to create an array of descriptive error strings. */
-#define BLKIF_BE_STATUS_ERRORS { \
- "Okay", \
- "Non-specific error", \
- "Interface already exists", \
- "Interface not found", \
- "Interface is still connected", \
- "VBD already exists", \
- "VBD not found", \
- "Out of memory", \
- "Extent not found for VBD", \
- "Could not map domain memory" }
-
-/*
- * CMSG_BLKIF_BE_CREATE:
- * When the driver sends a successful response then the interface is fully
- * created. The controller will send a DOWN notification to the front-end
- * driver.
- */
-typedef struct {
- /* IN */
- domid_t domid; /* 0: Domain attached to new interface. */
- u16 __pad;
- u32 blkif_handle; /* 4: Domain-specific interface handle. */
- /* OUT */
- u32 status; /* 8 */
-} PACKED blkif_be_create_t; /* 12 bytes */
-
-/*
- * CMSG_BLKIF_BE_DESTROY:
- * When the driver sends a successful response then the interface is fully
- * torn down. The controller will send a DESTROYED notification to the
- * front-end driver.
- */
-typedef struct {
- /* IN */
- domid_t domid; /* 0: Identify interface to be destroyed. */
- u16 __pad;
- u32 blkif_handle; /* 4: ...ditto... */
- /* OUT */
- u32 status; /* 8 */
-} PACKED blkif_be_destroy_t; /* 12 bytes */
-
-/*
- * CMSG_BLKIF_BE_CONNECT:
- * When the driver sends a successful response then the interface is fully
- * connected. The controller will send a CONNECTED notification to the
- * front-end driver.
- */
-typedef struct {
- /* IN */
- domid_t domid; /* 0: Domain attached to new interface. */
- u16 __pad;
- u32 blkif_handle; /* 4: Domain-specific interface handle. */
- memory_t shmem_frame; /* 8: Page cont. shared comms window. */
- MEMORY_PADDING;
- u32 evtchn; /* 16: Event channel for notifications. */
- /* OUT */
- u32 status; /* 20 */
-} PACKED blkif_be_connect_t; /* 24 bytes */
-
-/*
- * CMSG_BLKIF_BE_DISCONNECT:
- * When the driver sends a successful response then the interface is fully
- * disconnected. The controller will send a DOWN notification to the front-end
- * driver.
- */
-typedef struct {
- /* IN */
- domid_t domid; /* 0: Domain attached to new interface. */
- u16 __pad;
- u32 blkif_handle; /* 4: Domain-specific interface handle. */
- /* OUT */
- u32 status; /* 8 */
-} PACKED blkif_be_disconnect_t; /* 12 bytes */
-
-/* CMSG_BLKIF_BE_VBD_CREATE */
-typedef struct {
- /* IN */
- domid_t domid; /* 0: Identify blkdev interface. */
- u16 __pad;
- u32 blkif_handle; /* 4: ...ditto... */
- blkif_vdev_t vdevice; /* 8: Interface-specific id for this VBD. */
- u16 readonly; /* 10: Non-zero -> VBD isn't writable. */
- /* OUT */
- u32 status; /* 12 */
-} PACKED blkif_be_vbd_create_t; /* 16 bytes */
-
-/* CMSG_BLKIF_BE_VBD_DESTROY */
-typedef struct {
- /* IN */
- domid_t domid; /* 0: Identify blkdev interface. */
- u16 __pad0; /* 2 */
- u32 blkif_handle; /* 4: ...ditto... */
- blkif_vdev_t vdevice; /* 8: Interface-specific id of the VBD. */
- u16 __pad1; /* 10 */
- /* OUT */
- u32 status; /* 12 */
-} PACKED blkif_be_vbd_destroy_t; /* 16 bytes */
-
-/* CMSG_BLKIF_BE_VBD_GROW */
-typedef struct {
- /* IN */
- domid_t domid; /* 0: Identify blkdev interface. */
- u16 __pad0; /* 2 */
- u32 blkif_handle; /* 4: ...ditto... */
- blkif_extent_t extent; /* 8: Physical extent to append to VBD. */
- blkif_vdev_t vdevice; /* 28: Interface-specific id of the VBD. */
- u16 __pad1; /* 30 */
- /* OUT */
- u32 status; /* 32 */
-} PACKED blkif_be_vbd_grow_t; /* 36 bytes */
-
-/* CMSG_BLKIF_BE_VBD_SHRINK */
-typedef struct {
- /* IN */
- domid_t domid; /* 0: Identify blkdev interface. */
- u16 __pad0; /* 2 */
- u32 blkif_handle; /* 4: ...ditto... */
- blkif_vdev_t vdevice; /* 8: Interface-specific id of the VBD. */
- u16 __pad1; /* 10 */
- /* OUT */
- u32 status; /* 12 */
-} PACKED blkif_be_vbd_shrink_t; /* 16 bytes */
-
-/*
- * CMSG_BLKIF_BE_DRIVER_STATUS:
- * Notify the domain controller that the back-end driver is DOWN or UP.
- * If the driver goes DOWN while interfaces are still UP, the controller
- * will automatically send DOWN notifications.
- */
-typedef struct {
- u32 status; /* 0: BLKIF_DRIVER_STATUS_??? */
-} PACKED blkif_be_driver_status_t; /* 4 bytes */
-
-
-/******************************************************************************
- * NETWORK-INTERFACE FRONTEND DEFINITIONS
- */
-
-/* Messages from domain controller to guest. */
-#define CMSG_NETIF_FE_INTERFACE_STATUS 0
-
-/* Messages from guest to domain controller. */
-#define CMSG_NETIF_FE_DRIVER_STATUS 32
-#define CMSG_NETIF_FE_INTERFACE_CONNECT 33
-#define CMSG_NETIF_FE_INTERFACE_DISCONNECT 34
-#define CMSG_NETIF_FE_INTERFACE_QUERY 35
-
-/*
- * CMSG_NETIF_FE_INTERFACE_STATUS:
- * Notify a guest about a status change on one of its network interfaces.
- * If the interface is CLOSED or DOWN then the interface is disconnected:
- * 1. The shared-memory frame is available for reuse.
- * 2. Any unacknowledged messgaes pending on the interface were dropped.
- */
-#define NETIF_INTERFACE_STATUS_CLOSED 0 /* Interface doesn't exist. */
-#define NETIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
-#define NETIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
-#define NETIF_INTERFACE_STATUS_CHANGED 3 /* A device has been added or removed. */
-typedef struct {
- u32 handle; /* 0 */
- u32 status; /* 4 */
- u16 evtchn; /* 8: status == NETIF_INTERFACE_STATUS_CONNECTED */
- u8 mac[6]; /* 10: status == NETIF_INTERFACE_STATUS_CONNECTED */
- domid_t domid; /* 16: status != NETIF_INTERFACE_STATUS_DESTROYED */
-} PACKED netif_fe_interface_status_t; /* 18 bytes */
-
-/*
- * CMSG_NETIF_FE_DRIVER_STATUS:
- * Notify the domain controller that the front-end driver is DOWN or UP.
- * When the driver goes DOWN then the controller will send no more
- * status-change notifications.
- * If the driver goes DOWN while interfaces are still UP, the domain
- * will automatically take the interfaces DOWN.
- *
- * NB. The controller should not send an INTERFACE_STATUS message
- * for interfaces that are active when it receives an UP notification. We
- * expect that the frontend driver will query those interfaces itself.
- */
-#define NETIF_DRIVER_STATUS_DOWN 0
-#define NETIF_DRIVER_STATUS_UP 1
-typedef struct {
- /* IN */
- u32 status; /* 0: NETIF_DRIVER_STATUS_??? */
- /* OUT */
- /* Driver should query interfaces [0..max_handle]. */
- u32 max_handle; /* 4 */
-} PACKED netif_fe_driver_status_t; /* 8 bytes */
-
-/*
- * CMSG_NETIF_FE_INTERFACE_CONNECT:
- * If successful, the domain controller will acknowledge with a
- * STATUS_CONNECTED message.
- */
-typedef struct {
- u32 handle; /* 0 */
- u32 __pad; /* 4 */
- memory_t tx_shmem_frame; /* 8 */
- MEMORY_PADDING;
- memory_t rx_shmem_frame; /* 16 */
- MEMORY_PADDING;
-} PACKED netif_fe_interface_connect_t; /* 24 bytes */
-
-/*
- * CMSG_NETIF_FE_INTERFACE_DISCONNECT:
- * If successful, the domain controller will acknowledge with a
- * STATUS_DISCONNECTED message.
- */
-typedef struct {
- u32 handle; /* 0 */
-} PACKED netif_fe_interface_disconnect_t; /* 4 bytes */
-
-/*
- * CMSG_NETIF_FE_INTERFACE_QUERY:
- */
-typedef struct {
- /* IN */
- u32 handle; /* 0 */
- /* OUT */
- u32 status; /* 4 */
- u16 evtchn; /* 8: status == NETIF_INTERFACE_STATUS_CONNECTED */
- u8 mac[6]; /* 10: status == NETIF_INTERFACE_STATUS_CONNECTED */
- domid_t domid; /* 16: status != NETIF_INTERFACE_STATUS_DESTROYED */
-} PACKED netif_fe_interface_query_t; /* 18 bytes */
-
-
-/******************************************************************************
- * NETWORK-INTERFACE BACKEND DEFINITIONS
- */
-
-/* Messages from domain controller. */
-#define CMSG_NETIF_BE_CREATE 0 /* Create a new net-device interface. */
-#define CMSG_NETIF_BE_DESTROY 1 /* Destroy a net-device interface. */
-#define CMSG_NETIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
-#define CMSG_NETIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
-
-/* Messages to domain controller. */
-#define CMSG_NETIF_BE_DRIVER_STATUS 32
-
-/*
- * Message request/response definitions for net-device messages.
- */
-
-/* Non-specific 'okay' return. */
-#define NETIF_BE_STATUS_OKAY 0
-/* Non-specific 'error' return. */
-#define NETIF_BE_STATUS_ERROR 1
-/* The following are specific error returns. */
-#define NETIF_BE_STATUS_INTERFACE_EXISTS 2
-#define NETIF_BE_STATUS_INTERFACE_NOT_FOUND 3
-#define NETIF_BE_STATUS_INTERFACE_CONNECTED 4
-#define NETIF_BE_STATUS_OUT_OF_MEMORY 5
-#define NETIF_BE_STATUS_MAPPING_ERROR 6
-
-/* This macro can be used to create an array of descriptive error strings. */
-#define NETIF_BE_STATUS_ERRORS { \
- "Okay", \
- "Non-specific error", \
- "Interface already exists", \
- "Interface not found", \
- "Interface is still connected", \
- "Out of memory", \
- "Could not map domain memory" }
-
-/*
- * CMSG_NETIF_BE_CREATE:
- * When the driver sends a successful response then the interface is fully
- * created. The controller will send a DOWN notification to the front-end
- * driver.
- */
-typedef struct {
- /* IN */
- domid_t domid; /* 0: Domain attached to new interface. */
- u16 __pad0; /* 2 */
- u32 netif_handle; /* 4: Domain-specific interface handle. */
- u8 mac[6]; /* 8 */
- u16 __pad1; /* 14 */
- /* OUT */
- u32 status; /* 16 */
-} PACKED netif_be_create_t; /* 20 bytes */
-
-/*
- * CMSG_NETIF_BE_DESTROY:
- * When the driver sends a successful response then the interface is fully
- * torn down. The controller will send a DESTROYED notification to the
- * front-end driver.
- */
-typedef struct {
- /* IN */
- domid_t domid; /* 0: Identify interface to be destroyed. */
- u16 __pad;
- u32 netif_handle; /* 4: ...ditto... */
- /* OUT */
- u32 status; /* 8 */
-} PACKED netif_be_destroy_t; /* 12 bytes */
-
-/*
- * CMSG_NETIF_BE_CONNECT:
- * When the driver sends a successful response then the interface is fully
- * connected. The controller will send a CONNECTED notification to the
- * front-end driver.
- */
-typedef struct {
- /* IN */
- domid_t domid; /* 0: Domain attached to new interface. */
- u16 __pad0; /* 2 */
- u32 netif_handle; /* 4: Domain-specific interface handle. */
- memory_t tx_shmem_frame; /* 8: Page cont. tx shared comms window. */
- MEMORY_PADDING;
- memory_t rx_shmem_frame; /* 16: Page cont. rx shared comms window. */
- MEMORY_PADDING;
- u16 evtchn; /* 24: Event channel for notifications. */
- u16 __pad1; /* 26 */
- /* OUT */
- u32 status; /* 28 */
-} PACKED netif_be_connect_t; /* 32 bytes */
-
-/*
- * CMSG_NETIF_BE_DISCONNECT:
- * When the driver sends a successful response then the interface is fully
- * disconnected. The controller will send a DOWN notification to the front-end
- * driver.
- */
-typedef struct {
- /* IN */
- domid_t domid; /* 0: Domain attached to new interface. */
- u16 __pad;
- u32 netif_handle; /* 4: Domain-specific interface handle. */
- /* OUT */
- u32 status; /* 8 */
-} PACKED netif_be_disconnect_t; /* 12 bytes */
-
-/*
- * CMSG_NETIF_BE_DRIVER_STATUS:
- * Notify the domain controller that the back-end driver is DOWN or UP.
- * If the driver goes DOWN while interfaces are still UP, the domain
- * will automatically send DOWN notifications.
- */
-typedef struct {
- u32 status; /* 0: NETIF_DRIVER_STATUS_??? */
-} PACKED netif_be_driver_status_t; /* 4 bytes */
-
-
-/******************************************************************************
- * SHUTDOWN DEFINITIONS
- */
-
-/*
- * Subtypes for shutdown messages.
- */
-#define CMSG_SHUTDOWN_POWEROFF 0 /* Clean shutdown (SHUTDOWN_poweroff). */
-#define CMSG_SHUTDOWN_REBOOT 1 /* Clean shutdown (SHUTDOWN_reboot). */
-#define CMSG_SHUTDOWN_SUSPEND 2 /* Create suspend info, then */
- /* SHUTDOWN_suspend. */
-
-
-/******************************************************************************
- * MEMORY CONTROLS
- */
-
-#define CMSG_MEM_REQUEST_SET 0 /* Request a domain to set its mem footprint. */
-
-/*
- * CMSG_MEM_REQUEST:
- * Request that the domain change its memory reservation.
- */
-typedef struct {
- /* OUT */
- u32 target; /* 0: Target memory reservation in pages. */
- /* IN */
- u32 status; /* 4: Return code indicates success or failure. */
-} PACKED mem_request_t; /* 8 bytes */
-
-
-#endif /* __DOMAIN_CONTROLLER_H__ */
+++ /dev/null
-/******************************************************************************
- * netif.h
- *
- * Unified network-device I/O interface for Xen guest OSes.
- *
- * Copyright (c) 2003-2004, Keir Fraser
- */
-
-#ifndef __SHARED_NETIF_H__
-#define __SHARED_NETIF_H__
-
-typedef struct {
- memory_t addr; /* 0: Machine address of packet. */
- MEMORY_PADDING;
- u16 id; /* 8: Echoed in response message. */
- u16 size; /* 10: Packet size in bytes. */
-} PACKED netif_tx_request_t; /* 12 bytes */
-
-typedef struct {
- u16 id; /* 0 */
- s8 status; /* 2 */
- u8 __pad; /* 3 */
-} PACKED netif_tx_response_t; /* 4 bytes */
-
-typedef struct {
- u16 id; /* 0: Echoed in response message. */
-} PACKED netif_rx_request_t; /* 2 bytes */
-
-typedef struct {
- memory_t addr; /* 0: Machine address of packet. */
- MEMORY_PADDING;
- u16 id; /* 8: */
- s16 status; /* 10: -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
-} PACKED netif_rx_response_t; /* 12 bytes */
-
-/*
- * We use a special capitalised type name because it is _essential_ that all
- * arithmetic on indexes is done on an integer type of the correct size.
- */
-typedef u32 NETIF_RING_IDX;
-
-/*
- * Ring indexes are 'free running'. That is, they are not stored modulo the
- * size of the ring buffer. The following macros convert a free-running counter
- * into a value that can directly index a ring-buffer array.
- */
-#define MASK_NETIF_RX_IDX(_i) ((_i)&(NETIF_RX_RING_SIZE-1))
-#define MASK_NETIF_TX_IDX(_i) ((_i)&(NETIF_TX_RING_SIZE-1))
-
-#define NETIF_TX_RING_SIZE 256
-#define NETIF_RX_RING_SIZE 256
-
-/* This structure must fit in a memory page. */
-typedef struct {
- /*
- * Frontend places packets into ring at tx_req_prod.
- * Frontend receives event when tx_resp_prod passes tx_event.
- * 'req_cons' is a shadow of the backend's request consumer -- the frontend
- * may use it to determine if all queued packets have been seen by the
- * backend.
- */
- NETIF_RING_IDX req_prod; /* 0 */
- NETIF_RING_IDX req_cons; /* 4 */
- NETIF_RING_IDX resp_prod; /* 8 */
- NETIF_RING_IDX event; /* 12 */
- union { /* 16 */
- netif_tx_request_t req;
- netif_tx_response_t resp;
- } PACKED ring[NETIF_TX_RING_SIZE];
-} PACKED netif_tx_interface_t;
-
-/* This structure must fit in a memory page. */
-typedef struct {
- /*
- * Frontend places empty buffers into ring at rx_req_prod.
- * Frontend receives event when rx_resp_prod passes rx_event.
- */
- NETIF_RING_IDX req_prod; /* 0 */
- NETIF_RING_IDX resp_prod; /* 4 */
- NETIF_RING_IDX event; /* 8 */
- union { /* 12 */
- netif_rx_request_t req;
- netif_rx_response_t resp;
- } PACKED ring[NETIF_RX_RING_SIZE];
-} PACKED netif_rx_interface_t;
-
-/* Descriptor status values */
-#define NETIF_RSP_DROPPED -2
-#define NETIF_RSP_ERROR -1
-#define NETIF_RSP_OKAY 0
-
-#endif
+++ /dev/null
-/* -*- Mode:C; c-basic-offset:4; tab-width:4 -*-
- ****************************************************************************
- * (c) 2004 - Rolf Neugebauer - Intel Research Cambridge
- * (c) 2004 - Keir Fraser - University of Cambridge
- ****************************************************************************
- * Description: Interface for domains to access physical devices on the PCI bus
- */
-
-#ifndef __HYPERVISOR_IFS_PHYSDEV_H__
-#define __HYPERVISOR_IFS_PHYSDEV_H__
-
-/* Commands to HYPERVISOR_physdev_op() */
-#define PHYSDEVOP_PCI_CFGREG_READ 0
-#define PHYSDEVOP_PCI_CFGREG_WRITE 1
-#define PHYSDEVOP_PCI_INITIALISE_DEVICE 2
-#define PHYSDEVOP_PCI_PROBE_ROOT_BUSES 3
-#define PHYSDEVOP_IRQ_UNMASK_NOTIFY 4
-#define PHYSDEVOP_IRQ_STATUS_QUERY 5
-
-/* Read from PCI configuration space. */
-typedef struct {
- /* IN */
- u32 bus; /* 0 */
- u32 dev; /* 4 */
- u32 func; /* 8 */
- u32 reg; /* 12 */
- u32 len; /* 16 */
- /* OUT */
- u32 value; /* 20 */
-} PACKED physdevop_pci_cfgreg_read_t; /* 24 bytes */
-
-/* Write to PCI configuration space. */
-typedef struct {
- /* IN */
- u32 bus; /* 0 */
- u32 dev; /* 4 */
- u32 func; /* 8 */
- u32 reg; /* 12 */
- u32 len; /* 16 */
- u32 value; /* 20 */
-} PACKED physdevop_pci_cfgreg_write_t; /* 24 bytes */
-
-/* Do final initialisation of a PCI device (e.g., last-moment IRQ routing). */
-typedef struct {
- /* IN */
- u32 bus; /* 0 */
- u32 dev; /* 4 */
- u32 func; /* 8 */
-} PACKED physdevop_pci_initialise_device_t; /* 12 bytes */
-
-/* Find the root buses for subsequent scanning. */
-typedef struct {
- /* OUT */
- u32 busmask[256/32]; /* 0 */
-} PACKED physdevop_pci_probe_root_buses_t; /* 32 bytes */
-
-typedef struct {
- /* IN */
- u32 irq; /* 0 */
- /* OUT */
-/* Need to call PHYSDEVOP_IRQ_UNMASK_NOTIFY when the IRQ has been serviced? */
-#define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY (1<<0)
- u32 flags; /* 4 */
-} PACKED physdevop_irq_status_query_t; /* 8 bytes */
-
-typedef struct _physdev_op_st
-{
- u32 cmd; /* 0 */
- u32 __pad; /* 4 */
- union { /* 8 */
- physdevop_pci_cfgreg_read_t pci_cfgreg_read;
- physdevop_pci_cfgreg_write_t pci_cfgreg_write;
- physdevop_pci_initialise_device_t pci_initialise_device;
- physdevop_pci_probe_root_buses_t pci_probe_root_buses;
- physdevop_irq_status_query_t irq_status_query;
- u8 __dummy[32];
- } PACKED u;
-} PACKED physdev_op_t; /* 40 bytes */
-
-#endif /* __HYPERVISOR_IFS_PHYSDEV_H__ */
+++ /dev/null
-/**
- * Generic scheduler control interface.
- *
- * Mark Williamson, (C) 2004 Intel Research Cambridge
- */
-
-#ifndef __SCHED_CTL_H__
-#define __SCHED_CTL_H__
-
-/* Scheduler types */
-#define SCHED_BVT 0
-#define SCHED_ATROPOS 2
-#define SCHED_RROBIN 3
-
-/* these describe the intended direction used for a scheduler control or domain
- * command */
-#define SCHED_INFO_PUT 0
-#define SCHED_INFO_GET 1
-
-/*
- * Generic scheduler control command - used to adjust system-wide scheduler
- * parameters
- */
-struct sched_ctl_cmd
-{
- u32 sched_id; /* 0 */
- u32 direction; /* 4 */
- union { /* 8 */
- struct bvt_ctl
- {
- /* IN variables. */
- u32 ctx_allow; /* 8: context switch allowance */
- } PACKED bvt;
-
- struct rrobin_ctl
- {
- /* IN variables */
- u64 slice; /* 8: round robin time slice */
- } PACKED rrobin;
- } PACKED u;
-} PACKED; /* 16 bytes */
-
-struct sched_adjdom_cmd
-{
- u32 sched_id; /* 0 */
- u32 direction; /* 4 */
- domid_t domain; /* 8 */
- u16 __pad0;
- u32 __pad1;
- union { /* 16 */
- struct bvt_adjdom
- {
- u32 mcu_adv; /* 16: mcu advance: inverse of weight */
- u32 warpback; /* 20: warp? */
- s32 warpvalue; /* 24: warp value */
- long long warpl; /* 32: warp limit */
- long long warpu; /* 40: unwarp time requirement */
- } PACKED bvt;
-
- struct atropos_adjdom
- {
- u64 nat_period; /* 16 */
- u64 nat_slice; /* 24 */
- u64 latency; /* 32 */
- u32 xtratime; /* 36 */
- } PACKED atropos;
- } PACKED u;
-} PACKED; /* 40 bytes */
-
-#endif /* __SCHED_CTL_H__ */
+++ /dev/null
-/******************************************************************************
- * include/hypervisor-ifs/trace.h
- */
-
-#ifndef __HYPERVISOR_IFS_TRACE_H__
-#define __HYPERVISOR_IFS_TRACE_H__
-
-/* This structure represents a single trace buffer record. */
-struct t_rec {
- u64 cycles; /* 64 bit cycle counter timestamp */
- u32 event; /* 32 bit event ID */
- u32 d1, d2, d3, d4, d5; /* event data items */
-};
-
-/*
- * This structure contains the metadata for a single trace buffer. The head
- * field, indexes into an array of struct t_rec's.
- */
-struct t_buf {
- unsigned long data; /* pointer to data area. machine address
- * for convenience in user space code */
-
- unsigned long size; /* size of the data area, in t_recs */
- unsigned long head; /* array index of the most recent record */
-
- /* Xen-private elements follow... */
- struct t_rec *head_ptr; /* pointer to the head record */
- struct t_rec *vdata; /* virtual address pointer to data */
-};
-
-#endif /* __HYPERVISOR_IFS_TRACE_H__ */
--- /dev/null
+XEN NOTICE
+==========
+
+This copyright applies to all files within this subdirectory. All
+other files in the Xen source distribution are covered by version 2 of
+the GNU General Public License.
+
+ -- Keir Fraser (on behalf of the Xen team)
+
+=====================================================================
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
--- /dev/null
+/******************************************************************************
+ * arch-x86_32.h
+ *
+ * Guest OS interface to x86 32-bit Xen.
+ */
+
+#ifndef __XEN_PUBLIC_ARCH_X86_32_H__
+#define __XEN_PUBLIC_ARCH_X86_32_H__
+
+/*
+ * Pointers and other address fields inside interface structures are padded to
+ * 64 bits. This means that field alignments aren't different between 32- and
+ * 64-bit architectures.
+ */
+/* NB. Multi-level macro ensures __LINE__ is expanded before concatenation. */
+#define __MEMORY_PADDING(_X) u32 __pad_ ## _X
+#define _MEMORY_PADDING(_X) __MEMORY_PADDING(_X)
+#define MEMORY_PADDING _MEMORY_PADDING(__LINE__)
+
+/*
+ * SEGMENT DESCRIPTOR TABLES
+ */
+/*
+ * A number of GDT entries are reserved by Xen. These are not situated at the
+ * start of the GDT because some stupid OSes export hard-coded selector values
+ * in their ABI. These hard-coded values are always near the start of the GDT,
+ * so Xen places itself out of the way.
+ *
+ * NB. The reserved range is inclusive (that is, both FIRST_RESERVED_GDT_ENTRY
+ * and LAST_RESERVED_GDT_ENTRY are reserved).
+ */
+#define NR_RESERVED_GDT_ENTRIES 40
+#define FIRST_RESERVED_GDT_ENTRY 256
+#define LAST_RESERVED_GDT_ENTRY \
+ (FIRST_RESERVED_GDT_ENTRY + NR_RESERVED_GDT_ENTRIES - 1)
+
+
+/*
+ * These flat segments are in the Xen-private section of every GDT. Since these
+ * are also present in the initial GDT, many OSes will be able to avoid
+ * installing their own GDT.
+ */
+#define FLAT_RING1_CS 0x0819 /* GDT index 259 */
+#define FLAT_RING1_DS 0x0821 /* GDT index 260 */
+#define FLAT_RING3_CS 0x082b /* GDT index 261 */
+#define FLAT_RING3_DS 0x0833 /* GDT index 262 */
+
+#define FLAT_GUESTOS_CS FLAT_RING1_CS
+#define FLAT_GUESTOS_DS FLAT_RING1_DS
+#define FLAT_USER_CS FLAT_RING3_CS
+#define FLAT_USER_DS FLAT_RING3_DS
+
+/* And the trap vector is... */
+#define TRAP_INSTR "int $0x82"
+
+
+/*
+ * Virtual addresses beyond this are not modifiable by guest OSes. The
+ * machine->physical mapping table starts at this address, read-only.
+ */
+#define HYPERVISOR_VIRT_START (0xFC000000UL)
+#ifndef machine_to_phys_mapping
+#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
+#endif
+
+#ifndef __ASSEMBLY__
+
+/* NB. Both the following are 32 bits each. */
+typedef unsigned long memory_t; /* Full-sized pointer/address/memory-size. */
+typedef unsigned long cpureg_t; /* Full-sized register. */
+
+/*
+ * Send an array of these to HYPERVISOR_set_trap_table()
+ */
+#define TI_GET_DPL(_ti) ((_ti)->flags & 3)
+#define TI_GET_IF(_ti) ((_ti)->flags & 4)
+#define TI_SET_DPL(_ti,_dpl) ((_ti)->flags |= (_dpl))
+#define TI_SET_IF(_ti,_if) ((_ti)->flags |= ((!!(_if))<<2))
+typedef struct {
+ u8 vector; /* 0: exception vector */
+ u8 flags; /* 1: 0-3: privilege level; 4: clear event enable? */
+ u16 cs; /* 2: code selector */
+ memory_t address; /* 4: code address */
+} PACKED trap_info_t; /* 8 bytes */
+
+typedef struct
+{
+ unsigned long ebx;
+ unsigned long ecx;
+ unsigned long edx;
+ unsigned long esi;
+ unsigned long edi;
+ unsigned long ebp;
+ unsigned long eax;
+ unsigned long ds;
+ unsigned long es;
+ unsigned long fs;
+ unsigned long gs;
+ unsigned long _unused;
+ unsigned long eip;
+ unsigned long cs;
+ unsigned long eflags;
+ unsigned long esp;
+ unsigned long ss;
+} PACKED execution_context_t;
+
+typedef u64 tsc_timestamp_t; /* RDTSC timestamp */
+
+/*
+ * The following is all CPU context. Note that the i387_ctxt block is filled
+ * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
+ */
+typedef struct {
+#define ECF_I387_VALID (1<<0)
+ unsigned long flags;
+ execution_context_t cpu_ctxt; /* User-level CPU registers */
+ char fpu_ctxt[256]; /* User-level FPU registers */
+ trap_info_t trap_ctxt[256]; /* Virtual IDT */
+ unsigned int fast_trap_idx; /* "Fast trap" vector offset */
+ unsigned long ldt_base, ldt_ents; /* LDT (linear address, # ents) */
+ unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
+ unsigned long guestos_ss, guestos_esp; /* Virtual TSS (only SS1/ESP1) */
+ unsigned long pt_base; /* CR3 (pagetable base) */
+ unsigned long debugreg[8]; /* DB0-DB7 (debug registers) */
+ unsigned long event_callback_cs; /* CS:EIP of event callback */
+ unsigned long event_callback_eip;
+ unsigned long failsafe_callback_cs; /* CS:EIP of failsafe callback */
+ unsigned long failsafe_callback_eip;
+} PACKED full_execution_context_t;
+
+typedef struct {
+ u64 mfn_to_pfn_start; /* MFN of start of m2p table */
+ u64 pfn_to_mfn_frame_list; /* MFN of a table of MFNs that
+ make up p2m table */
+} PACKED arch_shared_info_t;
+
+#define ARCH_HAS_FAST_TRAP
+
+#endif
+
+#endif
--- /dev/null
+/******************************************************************************
+ * arch-x86_64.h
+ *
+ * Guest OS interface to x86 64-bit Xen.
+ */
+
+#ifndef __XEN_PUBLIC_ARCH_X86_64_H__
+#define __XEN_PUBLIC_ARCH_X86_64_H__
+
+/* Pointers are naturally 64 bits in this architecture; no padding needed. */
+#define _MEMORY_PADDING(_X)
+#define MEMORY_PADDING
+
+/*
+ * SEGMENT DESCRIPTOR TABLES
+ */
+/*
+ * A number of GDT entries are reserved by Xen. These are not situated at the
+ * start of the GDT because some stupid OSes export hard-coded selector values
+ * in their ABI. These hard-coded values are always near the start of the GDT,
+ * so Xen places itself out of the way.
+ *
+ * NB. The reserved range is inclusive (that is, both FIRST_RESERVED_GDT_ENTRY
+ * and LAST_RESERVED_GDT_ENTRY are reserved).
+ */
+#define NR_RESERVED_GDT_ENTRIES 40
+#define FIRST_RESERVED_GDT_ENTRY 256
+#define LAST_RESERVED_GDT_ENTRY \
+ (FIRST_RESERVED_GDT_ENTRY + NR_RESERVED_GDT_ENTRIES - 1)
+
+/*
+ * 64-bit segment selectors
+ * These flat segments are in the Xen-private section of every GDT. Since these
+ * are also present in the initial GDT, many OSes will be able to avoid
+ * installing their own GDT.
+ */
+
+#define FLAT_RING3_CS32 0x0823 /* GDT index 260 */
+#define FLAT_RING3_CS64 0x082b /* GDT index 261 */
+#define FLAT_RING3_DS 0x0833 /* GDT index 262 */
+
+#define FLAT_GUESTOS_DS FLAT_RING3_DS
+#define FLAT_GUESTOS_CS FLAT_RING3_CS64
+#define FLAT_GUESTOS_CS32 FLAT_RING3_CS32
+
+#define FLAT_USER_DS FLAT_RING3_DS
+#define FLAT_USER_CS FLAT_RING3_CS64
+#define FLAT_USER_CS32 FLAT_RING3_CS32
+
+/* And the trap vector is... */
+#define TRAP_INSTR "syscall"
+
+/* The machine->physical mapping table starts at this address, read-only. */
+#ifndef machine_to_phys_mapping
+#define machine_to_phys_mapping ((unsigned long *)0xffff810000000000ULL)
+#endif
+
+#ifndef __ASSEMBLY__
+
+/* NB. Both the following are 64 bits each. */
+typedef unsigned long memory_t; /* Full-sized pointer/address/memory-size. */
+typedef unsigned long cpureg_t; /* Full-sized register. */
+
+/*
+ * Send an array of these to HYPERVISOR_set_trap_table()
+ */
+#define TI_GET_DPL(_ti) ((_ti)->flags & 3)
+#define TI_GET_IF(_ti) ((_ti)->flags & 4)
+#define TI_SET_DPL(_ti,_dpl) ((_ti)->flags |= (_dpl))
+#define TI_SET_IF(_ti,_if) ((_ti)->flags |= ((!!(_if))<<2))
+typedef struct {
+ u8 vector; /* 0: exception vector */
+ u8 flags; /* 1: 0-3: privilege level; 4: clear event enable? */
+ u16 cs; /* 2: code selector */
+ u32 __pad; /* 4 */
+ memory_t address; /* 8: code address */
+} PACKED trap_info_t; /* 16 bytes */
+
+typedef struct
+{
+ unsigned long r15;
+ unsigned long r14;
+ unsigned long r13;
+ unsigned long r12;
+ unsigned long rbp;
+ unsigned long rbx;
+ unsigned long r11;
+ unsigned long r10;
+ unsigned long r9;
+ unsigned long r8;
+ unsigned long rax;
+ unsigned long rcx;
+ unsigned long rdx;
+ unsigned long rsi;
+ unsigned long rdi;
+ unsigned long rip;
+ unsigned long cs;
+ unsigned long eflags;
+ unsigned long rsp;
+ unsigned long ss;
+} PACKED execution_context_t;
+
+typedef u64 tsc_timestamp_t; /* RDTSC timestamp */
+
+/*
+ * The following is all CPU context. Note that the i387_ctxt block is filled
+ * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
+ */
+typedef struct {
+#define ECF_I387_VALID (1<<0)
+ unsigned long flags;
+ execution_context_t cpu_ctxt; /* User-level CPU registers */
+ char fpu_ctxt[512]; /* User-level FPU registers */
+ trap_info_t trap_ctxt[256]; /* Virtual IDT */
+ unsigned long ldt_base, ldt_ents; /* LDT (linear address, # ents) */
+ unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
+ unsigned long guestos_ss, guestos_esp; /* Virtual TSS (only SS1/ESP1) */
+ unsigned long pt_base; /* CR3 (pagetable base) */
+ unsigned long debugreg[8]; /* DB0-DB7 (debug registers) */
+ unsigned long event_callback_cs; /* CS:EIP of event callback */
+ unsigned long event_callback_eip;
+ unsigned long failsafe_callback_cs; /* CS:EIP of failsafe callback */
+ unsigned long failsafe_callback_eip;
+} PACKED full_execution_context_t;
+
+typedef struct {
+ u64 mfn_to_pfn_start; /* MFN of start of m2p table */
+ u64 pfn_to_mfn_frame_list; /* MFN of a table of MFNs that
+ make up p2m table */
+} PACKED arch_shared_info_t;
+
+#endif /* !__ASSEMBLY__ */
+
+#endif
--- /dev/null
+/******************************************************************************
+ * dom0_ops.h
+ *
+ * Process command requests from domain-0 guest OS.
+ *
+ * Copyright (c) 2002-2003, B Dragovic
+ * Copyright (c) 2002-2004, K Fraser
+ */
+
+
+#ifndef __XEN_PUBLIC_DOM0_OPS_H__
+#define __XEN_PUBLIC_DOM0_OPS_H__
+
+#include "xen.h"
+#include "sched_ctl.h"
+
+/*
+ * Make sure you increment the interface version whenever you modify this file!
+ * This makes sure that old versions of dom0 tools will stop working in a
+ * well-defined way (rather than crashing the machine, for instance).
+ */
+#define DOM0_INTERFACE_VERSION 0xAAAA0019
+
+/************************************************************************/
+
+#define DOM0_GETMEMLIST 2
+typedef struct {
+ /* IN variables. */
+ domid_t domain; /* 0 */
+ u16 __pad0;
+ u32 __pad1;
+ memory_t max_pfns; /* 8 */
+ MEMORY_PADDING;
+ void *buffer; /* 16 */
+ MEMORY_PADDING;
+ /* OUT variables. */
+ memory_t num_pfns; /* 24 */
+ MEMORY_PADDING;
+} PACKED dom0_getmemlist_t; /* 32 bytes */
+
+#define DOM0_SCHEDCTL 6
+ /* struct sched_ctl_cmd is from sched-ctl.h */
+typedef struct sched_ctl_cmd dom0_schedctl_t;
+
+#define DOM0_ADJUSTDOM 7
+/* struct sched_adjdom_cmd is from sched-ctl.h */
+typedef struct sched_adjdom_cmd dom0_adjustdom_t;
+
+#define DOM0_CREATEDOMAIN 8
+typedef struct {
+ /* IN parameters. */
+ memory_t memory_kb; /* 0 */
+ MEMORY_PADDING;
+ u32 cpu; /* 8 */
+ u32 __pad0; /* 12 */
+ /* IN/OUT parameters. */
+ /* If 0, domain is allocated. If non-zero use it unless in use. */
+ domid_t domain; /* 16 */
+ u16 __pad1;
+ /* OUT parameters. */
+} PACKED dom0_createdomain_t; /* 20 bytes */
+
+#define DOM0_DESTROYDOMAIN 9
+typedef struct {
+ /* IN variables. */
+ domid_t domain; /* 0 */
+ u16 __pad;
+} PACKED dom0_destroydomain_t; /* 4 bytes */
+
+#define DOM0_PAUSEDOMAIN 10
+typedef struct {
+ /* IN parameters. */
+ domid_t domain; /* 0 */
+ u16 __pad;
+} PACKED dom0_pausedomain_t; /* 4 bytes */
+
+#define DOM0_UNPAUSEDOMAIN 11
+typedef struct {
+ /* IN parameters. */
+ domid_t domain; /* 0 */
+ u16 __pad;
+} PACKED dom0_unpausedomain_t; /* 4 bytes */
+
+#define DOM0_GETDOMAININFO 12
+typedef struct {
+ /* IN variables. */
+ domid_t domain; /* 0 */ /* NB. IN/OUT variable. */
+ u16 __pad;
+ /* OUT variables. */
+#define DOMFLAGS_DYING (1<<0) /* Domain is scheduled to die. */
+#define DOMFLAGS_CRASHED (1<<1) /* Crashed domain; frozen for postmortem. */
+#define DOMFLAGS_SHUTDOWN (1<<2) /* The guest OS has shut itself down. */
+#define DOMFLAGS_PAUSED (1<<3) /* Currently paused by control software. */
+#define DOMFLAGS_BLOCKED (1<<4) /* Currently blocked pending an event. */
+#define DOMFLAGS_RUNNING (1<<5) /* Domain is currently running. */
+#define DOMFLAGS_CPUMASK 255 /* CPU to which this domain is bound. */
+#define DOMFLAGS_CPUSHIFT 8
+#define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code. */
+#define DOMFLAGS_SHUTDOWNSHIFT 16
+ u32 flags; /* 4 */
+ full_execution_context_t *ctxt; /* 8 */ /* NB. IN/OUT variable. */
+ MEMORY_PADDING;
+ memory_t tot_pages; /* 16 */
+ MEMORY_PADDING;
+ memory_t max_pages; /* 24 */
+ MEMORY_PADDING;
+ memory_t shared_info_frame; /* 32: MFN of shared_info struct */
+ MEMORY_PADDING;
+ u64 cpu_time; /* 40 */
+} PACKED dom0_getdomaininfo_t; /* 48 bytes */
+
+#define DOM0_BUILDDOMAIN 13
+typedef struct {
+ /* IN variables. */
+ domid_t domain; /* 0 */
+ u16 __pad0; /* 2 */
+ u32 __pad1; /* 4 */
+ /* IN/OUT parameters */
+ full_execution_context_t *ctxt; /* 8 */
+ MEMORY_PADDING;
+} PACKED dom0_builddomain_t; /* 16 bytes */
+
+#define DOM0_IOPL 14
+typedef struct {
+ domid_t domain; /* 0 */
+ u16 __pad;
+ u32 iopl; /* 4 */
+} PACKED dom0_iopl_t; /* 8 bytes */
+
+#define DOM0_MSR 15
+typedef struct {
+ /* IN variables. */
+ u32 write; /* 0 */
+ u32 cpu_mask; /* 4 */
+ u32 msr; /* 8 */
+ u32 in1; /* 12 */
+ u32 in2; /* 16 */
+ /* OUT variables. */
+ u32 out1; /* 20 */
+ u32 out2; /* 24 */
+} PACKED dom0_msr_t; /* 28 bytes */
+
+#define DOM0_DEBUG 16
+typedef struct {
+ /* IN variables. */
+ domid_t domain; /* 0 */
+ u8 opcode; /* 2 */
+ u8 __pad;
+ u32 in1; /* 4 */
+ u32 in2; /* 8 */
+ u32 in3; /* 12 */
+ u32 in4; /* 16 */
+ /* OUT variables. */
+ u32 status; /* 20 */
+ u32 out1; /* 24 */
+ u32 out2; /* 28 */
+} PACKED dom0_debug_t; /* 32 bytes */
+
+/*
+ * Set clock such that it would read <secs,usecs> after 00:00:00 UTC,
+ * 1 January, 1970 if the current system time was <system_time>.
+ */
+#define DOM0_SETTIME 17
+typedef struct {
+ /* IN variables. */
+ u32 secs; /* 0 */
+ u32 usecs; /* 4 */
+ u64 system_time; /* 8 */
+} PACKED dom0_settime_t; /* 16 bytes */
+
+#define DOM0_GETPAGEFRAMEINFO 18
+#define NOTAB 0 /* normal page */
+#define L1TAB (1<<28)
+#define L2TAB (2<<28)
+#define L3TAB (3<<28)
+#define L4TAB (4<<28)
+#define LPINTAB (1<<31)
+#define XTAB (0xf<<28) /* invalid page */
+#define LTAB_MASK XTAB
+#define LTABTYPE_MASK (0x7<<28)
+
+typedef struct {
+ /* IN variables. */
+ memory_t pfn; /* 0: Machine page frame number to query. */
+ MEMORY_PADDING;
+ domid_t domain; /* 8: To which domain does the frame belong? */
+ u16 __pad;
+ /* OUT variables. */
+ /* Is the page PINNED to a type? */
+ u32 type; /* 12: see above type defs */
+} PACKED dom0_getpageframeinfo_t; /* 16 bytes */
+
+/*
+ * Read console content from Xen buffer ring.
+ */
+#define DOM0_READCONSOLE 19
+typedef struct {
+ memory_t str; /* 0 */
+ MEMORY_PADDING;
+ u32 count; /* 8 */
+ u32 cmd; /* 12 */
+} PACKED dom0_readconsole_t; /* 16 bytes */
+
+/*
+ * Pin Domain to a particular CPU (use -1 to unpin)
+ */
+#define DOM0_PINCPUDOMAIN 20
+typedef struct {
+ /* IN variables. */
+ domid_t domain; /* 0 */
+ u16 __pad;
+ s32 cpu; /* 4: -1 implies unpin */
+} PACKED dom0_pincpudomain_t; /* 8 bytes */
+
+/* Get trace buffers machine base address */
+#define DOM0_GETTBUFS 21
+typedef struct {
+ /* OUT variables */
+ memory_t mach_addr; /* 0: location of the trace buffers */
+ MEMORY_PADDING;
+ u32 size; /* 8: size of each trace buffer, in bytes */
+} PACKED dom0_gettbufs_t; /* 12 bytes */
+
+/*
+ * Get physical information about the host machine
+ */
+#define DOM0_PHYSINFO 22
+typedef struct {
+ u32 ht_per_core; /* 0 */
+ u32 cores; /* 4 */
+ u32 cpu_khz; /* 8 */
+ u32 __pad; /* 12 */
+ memory_t total_pages; /* 16 */
+ MEMORY_PADDING;
+ memory_t free_pages; /* 24 */
+ MEMORY_PADDING;
+} PACKED dom0_physinfo_t; /* 32 bytes */
+
+/*
+ * Allow a domain access to a physical PCI device
+ */
+#define DOM0_PCIDEV_ACCESS 23
+typedef struct {
+ /* IN variables. */
+ domid_t domain; /* 0 */
+ u16 __pad;
+ u32 bus; /* 4 */
+ u32 dev; /* 8 */
+ u32 func; /* 12 */
+ u32 enable; /* 16 */
+} PACKED dom0_pcidev_access_t; /* 20 bytes */
+
+/*
+ * Get the ID of the current scheduler.
+ */
+#define DOM0_SCHED_ID 24
+typedef struct {
+ /* OUT variable */
+ u32 sched_id; /* 0 */
+} PACKED dom0_sched_id_t; /* 4 bytes */
+
+/*
+ * Control shadow pagetables operation
+ */
+#define DOM0_SHADOW_CONTROL 25
+
+#define DOM0_SHADOW_CONTROL_OP_OFF 0
+#define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST 1
+#define DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY 2
+#define DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE 3
+#define DOM0_SHADOW_CONTROL_OP_FLUSH 10 /* table ops */
+#define DOM0_SHADOW_CONTROL_OP_CLEAN 11
+#define DOM0_SHADOW_CONTROL_OP_PEEK 12
+
+typedef struct dom0_shadow_control
+{
+ u32 fault_count;
+ u32 dirty_count;
+ u32 dirty_net_count;
+ u32 dirty_block_count;
+} dom0_shadow_control_stats_t;
+
+typedef struct {
+ /* IN variables. */
+ domid_t domain; /* 0 */
+ u16 __pad;
+ u32 op; /* 4 */
+ unsigned long *dirty_bitmap; /* 8: pointer to locked buffer */
+ MEMORY_PADDING;
+ /* IN/OUT variables. */
+ memory_t pages; /* 16: size of buffer, updated with actual size */
+ MEMORY_PADDING;
+ /* OUT variables. */
+ dom0_shadow_control_stats_t stats;
+} PACKED dom0_shadow_control_t;
+
+#define DOM0_SETDOMAININITIALMEM 27
+typedef struct {
+ /* IN variables. */
+ domid_t domain; /* 0 */
+ u16 __pad0;
+ u32 __pad1;
+ memory_t initial_memkb; /* 8 */
+ MEMORY_PADDING;
+} PACKED dom0_setdomaininitialmem_t; /* 16 bytes */
+
+#define DOM0_SETDOMAINMAXMEM 28
+typedef struct {
+ /* IN variables. */
+ domid_t domain; /* 0 */
+ u16 __pad0;
+ u32 __pad1;
+ memory_t max_memkb; /* 8 */
+ MEMORY_PADDING;
+} PACKED dom0_setdomainmaxmem_t; /* 16 bytes */
+
+#define DOM0_GETPAGEFRAMEINFO2 29 /* batched interface */
+typedef struct {
+ /* IN variables. */
+ domid_t domain; /* 0 */
+ u16 __pad0;
+ u32 __pad1;
+ memory_t num; /* 8 */
+ MEMORY_PADDING;
+ /* IN/OUT variables. */
+ unsigned long *array; /* 16 */
+ MEMORY_PADDING;
+} PACKED dom0_getpageframeinfo2_t; /* 24 bytes */
+
+#define DOM0_SETDOMAINVMASSIST 30
+typedef struct {
+ /* IN variables. */
+ domid_t domain; /* 0 */
+ u16 __pad0;
+ u32 cmd; /* 4: vm_assist cmd */
+ u32 type; /* 8: vm_assist cmd */
+} PACKED dom0_setdomainvmassist_t; /* 12 bytes */
+
+typedef struct {
+ u32 cmd; /* 0 */
+ u32 interface_version; /* 4 */ /* DOM0_INTERFACE_VERSION */
+ union { /* 8 */
+ u32 dummy[18]; /* 72 bytes */
+ dom0_createdomain_t createdomain;
+ dom0_pausedomain_t pausedomain;
+ dom0_unpausedomain_t unpausedomain;
+ dom0_destroydomain_t destroydomain;
+ dom0_getmemlist_t getmemlist;
+ dom0_schedctl_t schedctl;
+ dom0_adjustdom_t adjustdom;
+ dom0_builddomain_t builddomain;
+ dom0_getdomaininfo_t getdomaininfo;
+ dom0_getpageframeinfo_t getpageframeinfo;
+ dom0_iopl_t iopl;
+ dom0_msr_t msr;
+ dom0_debug_t debug;
+ dom0_settime_t settime;
+ dom0_readconsole_t readconsole;
+ dom0_pincpudomain_t pincpudomain;
+ dom0_gettbufs_t gettbufs;
+ dom0_physinfo_t physinfo;
+ dom0_pcidev_access_t pcidev_access;
+ dom0_sched_id_t sched_id;
+ dom0_shadow_control_t shadow_control;
+ dom0_setdomaininitialmem_t setdomaininitialmem;
+ dom0_setdomainmaxmem_t setdomainmaxmem;
+ dom0_getpageframeinfo2_t getpageframeinfo2;
+ dom0_setdomainvmassist_t setdomainvmassist;
+ } PACKED u;
+} PACKED dom0_op_t; /* 80 bytes */
+
+#endif /* __XEN_PUBLIC_DOM0_OPS_H__ */
--- /dev/null
+/******************************************************************************
+ * event_channel.h
+ *
+ * Event channels between domains.
+ *
+ * Copyright (c) 2003-2004, K A Fraser.
+ */
+
+#ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__
+#define __XEN_PUBLIC_EVENT_CHANNEL_H__
+
+/*
+ * EVTCHNOP_alloc_unbound: Allocate a fresh local port and prepare
+ * it for binding to <dom>.
+ */
+#define EVTCHNOP_alloc_unbound 6
+typedef struct {
+ /* IN parameters */
+ domid_t dom; /* 0 */
+ u16 __pad;
+ /* OUT parameters */
+ u32 port; /* 4 */
+} PACKED evtchn_alloc_unbound_t; /* 8 bytes */
+
+/*
+ * EVTCHNOP_bind_interdomain: Construct an interdomain event channel between
+ * <dom1> and <dom2>. Either <port1> or <port2> may be wildcarded by setting to
+ * zero. On successful return both <port1> and <port2> are filled in and
+ * <dom1,port1> is fully bound to <dom2,port2>.
+ *
+ * NOTES:
+ * 1. A wildcarded port is allocated from the relevant domain's free list
+ * (i.e., some port that was previously EVTCHNSTAT_closed). However, if the
+ * remote port pair is already fully bound then a port is not allocated,
+ * and instead the existing local port is returned to the caller.
+ * 2. If the caller is unprivileged then <dom1> must be DOMID_SELF.
+ * 3. If the caller is unprivileged and <dom2,port2> is EVTCHNSTAT_closed
+ * then <dom2> must be DOMID_SELF.
+ * 4. If either port is already bound then it must be bound to the other
+ * specified domain and port (if not wildcarded).
+ * 5. If either port is awaiting binding (EVTCHNSTAT_unbound) then it must
+ * be awaiting binding to the other domain, and the other port pair must
+ * be closed or unbound.
+ */
+#define EVTCHNOP_bind_interdomain 0
+typedef struct {
+ /* IN parameters. */
+ domid_t dom1, dom2; /* 0, 2 */
+ /* IN/OUT parameters. */
+ u32 port1, port2; /* 4, 8 */
+} PACKED evtchn_bind_interdomain_t; /* 12 bytes */
+
+/*
+ * EVTCHNOP_bind_virq: Bind a local event channel to IRQ <irq>.
+ * NOTES:
+ * 1. A virtual IRQ may be bound to at most one event channel per domain.
+ */
+#define EVTCHNOP_bind_virq 1
+typedef struct {
+ /* IN parameters. */
+ u32 virq; /* 0 */
+ /* OUT parameters. */
+ u32 port; /* 4 */
+} PACKED evtchn_bind_virq_t; /* 8 bytes */
+
+/*
+ * EVTCHNOP_bind_pirq: Bind a local event channel to IRQ <irq>.
+ * NOTES:
+ * 1. A physical IRQ may be bound to at most one event channel per domain.
+ * 2. Only a sufficiently-privileged domain may bind to a physical IRQ.
+ */
+#define EVTCHNOP_bind_pirq 2
+typedef struct {
+ /* IN parameters. */
+ u32 pirq; /* 0 */
+#define BIND_PIRQ__WILL_SHARE 1
+ u32 flags; /* BIND_PIRQ__* */ /* 4 */
+ /* OUT parameters. */
+ u32 port; /* 8 */
+} PACKED evtchn_bind_pirq_t; /* 12 bytes */
+
+/*
+ * EVTCHNOP_close: Close the communication channel which has an endpoint at
+ * <dom, port>. If the channel is interdomain then the remote end is placed in
+ * the unbound state (EVTCHNSTAT_unbound), awaiting a new connection.
+ * NOTES:
+ * 1. <dom> may be specified as DOMID_SELF.
+ * 2. Only a sufficiently-privileged domain may close an event channel
+ * for which <dom> is not DOMID_SELF.
+ */
+#define EVTCHNOP_close 3
+typedef struct {
+ /* IN parameters. */
+ domid_t dom; /* 0 */
+ u16 __pad;
+ u32 port; /* 4 */
+ /* No OUT parameters. */
+} PACKED evtchn_close_t; /* 8 bytes */
+
+/*
+ * EVTCHNOP_send: Send an event to the remote end of the channel whose local
+ * endpoint is <DOMID_SELF, local_port>.
+ */
+#define EVTCHNOP_send 4
+typedef struct {
+ /* IN parameters. */
+ u32 local_port; /* 0 */
+ /* No OUT parameters. */
+} PACKED evtchn_send_t; /* 4 bytes */
+
+/*
+ * EVTCHNOP_status: Get the current status of the communication channel which
+ * has an endpoint at <dom, port>.
+ * NOTES:
+ * 1. <dom> may be specified as DOMID_SELF.
+ * 2. Only a sufficiently-privileged domain may obtain the status of an event
+ * channel for which <dom> is not DOMID_SELF.
+ */
+#define EVTCHNOP_status 5
+typedef struct {
+ /* IN parameters */
+ domid_t dom; /* 0 */
+ u16 __pad;
+ u32 port; /* 4 */
+ /* OUT parameters */
+#define EVTCHNSTAT_closed 0 /* Channel is not in use. */
+#define EVTCHNSTAT_unbound 1 /* Channel is waiting interdom connection.*/
+#define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
+#define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
+#define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
+ u32 status; /* 8 */
+ union { /* 12 */
+ struct {
+ domid_t dom; /* 12 */
+ } PACKED unbound; /* EVTCHNSTAT_unbound */
+ struct {
+ domid_t dom; /* 12 */
+ u16 __pad;
+ u32 port; /* 16 */
+ } PACKED interdomain; /* EVTCHNSTAT_interdomain */
+ u32 pirq; /* EVTCHNSTAT_pirq */ /* 12 */
+ u32 virq; /* EVTCHNSTAT_virq */ /* 12 */
+ } PACKED u;
+} PACKED evtchn_status_t; /* 20 bytes */
+
+typedef struct {
+ u32 cmd; /* EVTCHNOP_* */ /* 0 */
+ u32 __reserved; /* 4 */
+ union { /* 8 */
+ evtchn_alloc_unbound_t alloc_unbound;
+ evtchn_bind_interdomain_t bind_interdomain;
+ evtchn_bind_virq_t bind_virq;
+ evtchn_bind_pirq_t bind_pirq;
+ evtchn_close_t close;
+ evtchn_send_t send;
+ evtchn_status_t status;
+ u8 __dummy[24];
+ } PACKED u;
+} PACKED evtchn_op_t; /* 32 bytes */
+
+#endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */
--- /dev/null
+/******************************************************************************
+ * grant_table.h
+ *
+ * Interface for granting foreign access to page frames, and receiving
+ * page-ownership transfers.
+ *
+ * Copyright (c) 2004, K A Fraser
+ */
+
+#ifndef __XEN_PUBLIC_GRANT_TABLE_H__
+#define __XEN_PUBLIC_GRANT_TABLE_H__
+
+
+/***********************************
+ * GRANT TABLE REPRESENTATION
+ */
+
+/* Some rough guidelines on accessing and updating grant-table entries
+ * in a concurrency-safe manner. For more information, Linux contains a
+ * reference implementation for guest OSes (arch/xen/kernel/grant_table.c).
+ *
+ * NB. WMB is a no-op on current-generation x86 processors. However, a
+ * compiler barrier will still be required.
+ *
+ * Introducing a valid entry into the grant table:
+ * 1. Write ent->domid.
+ * 2. Write ent->frame:
+ * GTF_permit_access: Frame to which access is permitted.
+ * GTF_accept_transfer: Pseudo-phys frame slot being filled by new
+ * frame, or zero if none.
+ * 3. Write memory barrier (WMB).
+ * 4. Write ent->flags, inc. valid type.
+ *
+ * Invalidating an unused GTF_permit_access entry:
+ * 1. flags = ent->flags.
+ * 2. Observe that !(flags & (GTF_reading|GTF_writing)).
+ * 3. Check result of SMP-safe CMPXCHG(&ent->flags, flags, 0).
+ * NB. No need for WMB as reuse of entry is control-dependent on success of
+ * step 3, and all architectures guarantee ordering of ctrl-dep writes.
+ *
+ * Invalidating an in-use GTF_permit_access entry:
+ * This cannot be done directly. Request assistance from the domain controller
+ * which can set a timeout on the use of a grant entry and take necessary
+ * action. (NB. This is not yet implemented!).
+ *
+ * Invalidating an unused GTF_accept_transfer entry:
+ * 1. flags = ent->flags.
+ * 2. Observe that !(flags & GTF_transfer_committed). [*]
+ * 3. Check result of SMP-safe CMPXCHG(&ent->flags, flags, 0).
+ * NB. No need for WMB as reuse of entry is control-dependent on success of
+ * step 3, and all architectures guarantee ordering of ctrl-dep writes.
+ * [*] If GTF_transfer_committed is set then the grant entry is 'committed'.
+ * The guest must /not/ modify the grant entry until the address of the
+ * transferred frame is written. It is safe for the guest to spin waiting
+ * for this to occur (detect by observing GTF_transfer_completed in
+ * ent->flags).
+ *
+ * Invalidating a committed GTF_accept_transfer entry:
+ * 1. Wait for (ent->flags & GTF_transfer_completed).
+ *
+ * Changing a GTF_permit_access from writable to read-only:
+ * Use SMP-safe CMPXCHG to set GTF_readonly, while checking !GTF_writing.
+ *
+ * Changing a GTF_permit_access from read-only to writable:
+ * Use SMP-safe bit-setting instruction.
+ */
+
+/*
+ * A grant table comprises a packed array of grant entries in one or more
+ * page frames shared between Xen and a guest.
+ * [XEN]: This field is written by Xen and read by the sharing guest.
+ * [GST]: This field is written by the guest and read by Xen.
+ */
+typedef struct {
+ /* GTF_xxx: various type and flag information. [XEN,GST] */
+ u16 flags; /* 0 */
+ /* The domain being granted foreign privileges. [GST] */
+ domid_t domid; /* 2 */
+ /*
+ * GTF_permit_access: Frame that @domid is allowed to map and access. [GST]
+ * GTF_accept_transfer: Frame whose ownership transferred by @domid. [XEN]
+ */
+ u32 frame; /* 4 */
+} PACKED grant_entry_t; /* 8 bytes */
+
+/*
+ * Type of grant entry.
+ * GTF_invalid: This grant entry grants no privileges.
+ * GTF_permit_access: Allow @domid to map/access @frame.
+ * GTF_accept_transfer: Allow @domid to transfer ownership of one page frame
+ * to this guest. Xen writes the page number to @frame.
+ */
+#define GTF_invalid (0U<<0)
+#define GTF_permit_access (1U<<0)
+#define GTF_accept_transfer (2U<<0)
+#define GTF_type_mask (3U<<0)
+
+/*
+ * Subflags for GTF_permit_access.
+ * GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST]
+ * GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN]
+ * GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN]
+ */
+#define _GTF_readonly (2)
+#define GTF_readonly (1U<<_GTF_readonly)
+#define _GTF_reading (3)
+#define GTF_reading (1U<<_GTF_reading)
+#define _GTF_writing (4)
+#define GTF_writing (1U<<_GTF_writing)
+
+/*
+ * Subflags for GTF_accept_transfer:
+ * GTF_transfer_committed: Xen sets this flag to indicate that it is committed
+ * to transferring ownership of a page frame. When a guest sees this flag
+ * it must /not/ modify the grant entry until GTF_transfer_completed is
+ * set by Xen.
+ * GTF_transfer_completed: It is safe for the guest to spin-wait on this flag
+ * after reading GTF_transfer_committed. Xen will always write the frame
+ * address, followed by ORing this flag, in a timely manner.
+ */
+#define _GTF_transfer_committed (2)
+#define GTF_transfer_committed (1U<<_GTF_transfer_committed)
+#define _GTF_transfer_completed (3)
+#define GTF_transfer_completed (1U<<_GTF_transfer_completed)
+
+
+/***********************************
+ * GRANT TABLE QUERIES AND USES
+ */
+
+/*
+ * Reference to a grant entry in a specified domain's grant table.
+ */
+typedef u16 grant_ref_t;
+
+/*
+ * GNTTABOP_map_grant_ref: Map the grant entry (<dom>,<ref>) for access
+ * by devices and/or host CPUs. If successful, <handle> is a tracking number
+ * that must be presented later to destroy the mapping(s). On error, <handle>
+ * is a negative status code.
+ * NOTES:
+ * 1. If GNTPIN_map_for_dev is specified then <dev_bus_addr> is the address
+ * via which I/O devices may access the granted frame.
+ * 2. If GNTPIN_map_for_host is specified then a mapping will be added at
+ * virtual address <host_virt_addr> in the current address space.
+ * 3. Mappings should only be destroyed via GNTTABOP_unmap_grant_ref. If a
+ * host mapping is destroyed by other means then it is *NOT* guaranteed
+ * to be accounted to the correct grant reference!
+ */
+#define GNTTABOP_map_grant_ref 0
+typedef struct {
+ /* IN parameters. */
+ memory_t host_virt_addr; /* 0 */
+ MEMORY_PADDING;
+ domid_t dom; /* 8 */
+ grant_ref_t ref; /* 10 */
+ u16 flags; /* 12: GNTMAP_* */
+ /* OUT parameters. */
+ s16 handle; /* 14: +ve: handle; -ve: GNTST_* */
+ memory_t dev_bus_addr; /* 16 */
+ MEMORY_PADDING;
+} PACKED gnttab_map_grant_ref_t; /* 24 bytes */
+
+/*
+ * GNTTABOP_unmap_grant_ref: Destroy one or more grant-reference mappings
+ * tracked by <handle>. If <host_virt_addr> or <dev_bus_addr> is zero, that
+ * field is ignored. If non-zero, they must refer to a device/host mapping
+ * that is tracked by <handle>
+ * NOTES:
+ * 1. The call may fail in an undefined manner if either mapping is not
+ * tracked by <handle>.
+ * 3. After executing a batch of unmaps, it is guaranteed that no stale
+ * mappings will remain in the device or host TLBs.
+ */
+#define GNTTABOP_unmap_grant_ref 1
+typedef struct {
+ /* IN parameters. */
+ memory_t host_virt_addr; /* 0 */
+ MEMORY_PADDING;
+ memory_t dev_bus_addr; /* 8 */
+ MEMORY_PADDING;
+ u16 handle; /* 16 */
+ /* OUT parameters. */
+ s16 status; /* 18: GNTST_* */
+ u32 __pad;
+} PACKED gnttab_unmap_grant_ref_t; /* 24 bytes */
+
+/*
+ * GNTTABOP_setup_table: Set up a grant table for <dom> comprising at least
+ * <nr_frames> pages. The frame addresses are written to the <frame_list>.
+ * Only <nr_frames> addresses are written, even if the table is larger.
+ * NOTES:
+ * 1. <dom> may be specified as DOMID_SELF.
+ * 2. Only a sufficiently-privileged domain may specify <dom> != DOMID_SELF.
+ * 3. Xen may not support more than a single grant-table page per domain.
+ */
+#define GNTTABOP_setup_table 2
+typedef struct {
+ /* IN parameters. */
+ domid_t dom; /* 0 */
+ u16 nr_frames; /* 2 */
+ u16 __pad;
+ /* OUT parameters. */
+ s16 status; /* 6: GNTST_* */
+ unsigned long *frame_list; /* 8 */
+ MEMORY_PADDING;
+} PACKED gnttab_setup_table_t; /* 16 bytes */
+
+/*
+ * Bitfield values for update_pin_status.flags.
+ */
+ /* Map the grant entry for access by I/O devices. */
+#define _GNTMAP_device_map (0)
+#define GNTMAP_device_map (1<<_GNTMAP_device_map)
+ /* Map the grant entry for access by host CPUs. */
+#define _GNTMAP_host_map (1)
+#define GNTMAP_host_map (1<<_GNTMAP_host_map)
+ /* Accesses to the granted frame will be restricted to read-only access. */
+#define _GNTMAP_readonly (2)
+#define GNTMAP_readonly (1<<_GNTMAP_readonly)
+ /*
+ * GNTMAP_host_map subflag:
+ * 0 => The host mapping is usable only by the guest OS.
+ * 1 => The host mapping is usable by guest OS + current application.
+ */
+#define _GNTMAP_application_map (3)
+#define GNTMAP_application_map (1<<_GNTMAP_application_map)
+
+/*
+ * Values for error status returns. All errors are -ve.
+ */
+#define GNTST_okay (0)
+#define GNTST_general_error (-1) /* General undefined error. */
+#define GNTST_bad_domain (-2) /* Unrecognsed domain id. */
+#define GNTST_bad_gntref (-3) /* Unrecognised or inappropriate gntref. */
+#define GNTST_bad_handle (-3) /* Unrecognised or inappropriate handle. */
+#define GNTST_no_device_space (-4) /* Out of space in I/O MMU. */
+#define GNTST_permission_denied (-5) /* Not enough privilege for operation. */
+
+#define GNTTABOP_error_msgs { \
+ "okay", \
+ "undefined error", \
+ "unrecognised domain id", \
+ "invalid grant reference", \
+ "invalid mapping handle", \
+ "no spare translation slot in the I/O MMU", \
+ "permission denied" \
+}
+
+
+#endif /* __XEN_PUBLIC_GRANT_TABLE_H__ */
--- /dev/null
+/******************************************************************************
+ * blkif.h
+ *
+ * Unified block-device I/O interface for Xen guest OSes.
+ *
+ * Copyright (c) 2003-2004, Keir Fraser
+ */
+
+#ifndef __XEN_PUBLIC_IO_BLKIF_H__
+#define __XEN_PUBLIC_IO_BLKIF_H__
+
+#define blkif_vdev_t u16
+#define blkif_sector_t u64
+
+#define BLKIF_OP_READ 0
+#define BLKIF_OP_WRITE 1
+#define BLKIF_OP_PROBE 2
+
+/* NB. Ring size must be small enough for sizeof(blkif_ring_t) <= PAGE_SIZE. */
+#define BLKIF_RING_SIZE 64
+
+/*
+ * Maximum scatter/gather segments per request.
+ * This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE.
+ * NB. This could be 12 if the ring indexes weren't stored in the same page.
+ */
+#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
+
+typedef struct {
+ u8 operation; /* 0: BLKIF_OP_??? */
+ u8 nr_segments; /* 1: number of segments */
+ blkif_vdev_t device; /* 2: only for read/write requests */
+ unsigned long id; /* 4: private guest value, echoed in resp */
+ blkif_sector_t sector_number; /* start sector idx on disk (r/w only) */
+ /* @f_a_s[2:0]=last_sect ; @f_a_s[5:3]=first_sect ; @f_a_s[:12]=frame. */
+ /* @first_sect: first sector in frame to transfer (inclusive). */
+ /* @last_sect: last sector in frame to transfer (inclusive). */
+ /* @frame: machine page frame number. */
+ unsigned long frame_and_sects[BLKIF_MAX_SEGMENTS_PER_REQUEST];
+} PACKED blkif_request_t;
+
+#define blkif_first_sect(_fas) (((_fas)>>3)&7)
+#define blkif_last_sect(_fas) ((_fas)&7)
+
+typedef struct {
+ unsigned long id; /* copied from request */
+ u8 operation; /* copied from request */
+ s16 status; /* BLKIF_RSP_??? */
+} PACKED blkif_response_t;
+
+#define BLKIF_RSP_ERROR -1 /* non-specific 'error' */
+#define BLKIF_RSP_OKAY 0 /* non-specific 'okay' */
+
+/*
+ * We use a special capitalised type name because it is _essential_ that all
+ * arithmetic on indexes is done on an integer type of the correct size.
+ */
+typedef u32 BLKIF_RING_IDX;
+
+/*
+ * Ring indexes are 'free running'. That is, they are not stored modulo the
+ * size of the ring buffer. The following macro converts a free-running counter
+ * into a value that can directly index a ring-buffer array.
+ */
+#define MASK_BLKIF_IDX(_i) ((_i)&(BLKIF_RING_SIZE-1))
+
+typedef struct {
+ BLKIF_RING_IDX req_prod; /* 0: Request producer. Updated by front-end. */
+ BLKIF_RING_IDX resp_prod; /* 4: Response producer. Updated by back-end. */
+ union { /* 8 */
+ blkif_request_t req;
+ blkif_response_t resp;
+ } PACKED ring[BLKIF_RING_SIZE];
+} PACKED blkif_ring_t;
+
+
+/*
+ * BLKIF_OP_PROBE:
+ * The request format for a probe request is constrained as follows:
+ * @operation == BLKIF_OP_PROBE
+ * @nr_segments == size of probe buffer in pages
+ * @device == unused (zero)
+ * @id == any value (echoed in response message)
+ * @sector_num == unused (zero)
+ * @frame_and_sects == list of page-sized buffers.
+ * (i.e., @first_sect == 0, @last_sect == 7).
+ *
+ * The response is a list of vdisk_t elements copied into the out-of-band
+ * probe buffer. On success the response status field contains the number
+ * of vdisk_t elements.
+ */
+
+/* XXX SMH: Type values below are chosen to match ide_xxx in Linux ide.h. */
+#define VDISK_TYPE_FLOPPY 0x00
+#define VDISK_TYPE_TAPE 0x01
+#define VDISK_TYPE_CDROM 0x05
+#define VDISK_TYPE_OPTICAL 0x07
+#define VDISK_TYPE_DISK 0x20
+
+#define VDISK_TYPE_MASK 0x3F
+#define VDISK_TYPE(_x) ((_x) & VDISK_TYPE_MASK)
+
+/* The top two bits of the type field encode various flags. */
+#define VDISK_FLAG_RO 0x40
+#define VDISK_FLAG_VIRT 0x80
+#define VDISK_READONLY(_x) ((_x) & VDISK_FLAG_RO)
+#define VDISK_VIRTUAL(_x) ((_x) & VDISK_FLAG_VIRT)
+
+typedef struct {
+ blkif_sector_t capacity; /* 0: Size in terms of 512-byte sectors. */
+ blkif_vdev_t device; /* 8: Device number (opaque 16 bit value). */
+ u16 info; /* 10: Device type and flags (VDISK_*). */
+} PACKED vdisk_t; /* 12 bytes */
+
+#endif /* __XEN_PUBLIC_IO_BLKIF_H__ */
--- /dev/null
+/******************************************************************************
+ * domain_controller.h
+ *
+ * Interface to server controller (e.g., 'xend'). This header file defines the
+ * interface that is shared with guest OSes.
+ *
+ * Copyright (c) 2004, K A Fraser
+ */
+
+#ifndef __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__
+#define __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__
+
+
+/*
+ * Reason codes for SCHEDOP_shutdown. These are opaque to Xen but may be
+ * interpreted by control software to determine the appropriate action. These
+ * are only really advisories: the controller can actually do as it likes.
+ */
+#define SHUTDOWN_poweroff 0 /* Domain exited normally. Clean up and kill. */
+#define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */
+#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
+
+
+/*
+ * CONTROLLER MESSAGING INTERFACE.
+ */
+
+typedef struct {
+ u8 type; /* 0: echoed in response */
+ u8 subtype; /* 1: echoed in response */
+ u8 id; /* 2: echoed in response */
+ u8 length; /* 3: number of bytes in 'msg' */
+ u8 msg[60]; /* 4: type-specific message data */
+} PACKED control_msg_t; /* 64 bytes */
+
+#define CONTROL_RING_SIZE 8
+typedef u32 CONTROL_RING_IDX;
+#define MASK_CONTROL_IDX(_i) ((_i)&(CONTROL_RING_SIZE-1))
+
+typedef struct {
+ control_msg_t tx_ring[CONTROL_RING_SIZE]; /* 0: guest -> controller */
+ control_msg_t rx_ring[CONTROL_RING_SIZE]; /* 512: controller -> guest */
+ CONTROL_RING_IDX tx_req_prod, tx_resp_prod; /* 1024, 1028 */
+ CONTROL_RING_IDX rx_req_prod, rx_resp_prod; /* 1032, 1036 */
+} PACKED control_if_t; /* 1040 bytes */
+
+/*
+ * Top-level command types.
+ */
+#define CMSG_CONSOLE 0 /* Console */
+#define CMSG_BLKIF_BE 1 /* Block-device backend */
+#define CMSG_BLKIF_FE 2 /* Block-device frontend */
+#define CMSG_NETIF_BE 3 /* Network-device backend */
+#define CMSG_NETIF_FE 4 /* Network-device frontend */
+#define CMSG_SHUTDOWN 6 /* Shutdown messages */
+#define CMSG_MEM_REQUEST 7 /* Memory reservation reqs */
+
+
+/******************************************************************************
+ * CONSOLE DEFINITIONS
+ */
+
+/*
+ * Subtypes for console messages.
+ */
+#define CMSG_CONSOLE_DATA 0
+
+
+/******************************************************************************
+ * BLOCK-INTERFACE FRONTEND DEFINITIONS
+ */
+
+/* Messages from domain controller to guest. */
+#define CMSG_BLKIF_FE_INTERFACE_STATUS 0
+
+/* Messages from guest to domain controller. */
+#define CMSG_BLKIF_FE_DRIVER_STATUS 32
+#define CMSG_BLKIF_FE_INTERFACE_CONNECT 33
+#define CMSG_BLKIF_FE_INTERFACE_DISCONNECT 34
+#define CMSG_BLKIF_FE_INTERFACE_QUERY 35
+
+/* These are used by both front-end and back-end drivers. */
+#define blkif_vdev_t u16
+#define blkif_pdev_t u16
+#define blkif_sector_t u64
+
+/*
+ * CMSG_BLKIF_FE_INTERFACE_STATUS:
+ * Notify a guest about a status change on one of its block interfaces.
+ * If the interface is DESTROYED or DOWN then the interface is disconnected:
+ * 1. The shared-memory frame is available for reuse.
+ * 2. Any unacknowledged messages pending on the interface were dropped.
+ */
+#define BLKIF_INTERFACE_STATUS_CLOSED 0 /* Interface doesn't exist. */
+#define BLKIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
+#define BLKIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
+#define BLKIF_INTERFACE_STATUS_CHANGED 3 /* A device has been added or removed. */
+typedef struct {
+ u32 handle; /* 0 */
+ u32 status; /* 4 */
+ u16 evtchn; /* 8: (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
+ domid_t domid; /* 10: status != BLKIF_INTERFACE_STATUS_DESTROYED */
+} PACKED blkif_fe_interface_status_t; /* 12 bytes */
+
+/*
+ * CMSG_BLKIF_FE_DRIVER_STATUS:
+ * Notify the domain controller that the front-end driver is DOWN or UP.
+ * When the driver goes DOWN then the controller will send no more
+ * status-change notifications.
+ * If the driver goes DOWN while interfaces are still UP, the domain
+ * will automatically take the interfaces DOWN.
+ *
+ * NB. The controller should not send an INTERFACE_STATUS_CHANGED message
+ * for interfaces that are active when it receives an UP notification. We
+ * expect that the frontend driver will query those interfaces itself.
+ */
+#define BLKIF_DRIVER_STATUS_DOWN 0
+#define BLKIF_DRIVER_STATUS_UP 1
+typedef struct {
+ /* IN */
+ u32 status; /* 0: BLKIF_DRIVER_STATUS_??? */
+ /* OUT */
+ /* Driver should query interfaces [0..max_handle]. */
+ u32 max_handle; /* 4 */
+} PACKED blkif_fe_driver_status_t; /* 8 bytes */
+
+/*
+ * CMSG_BLKIF_FE_INTERFACE_CONNECT:
+ * If successful, the domain controller will acknowledge with a
+ * STATUS_CONNECTED message.
+ */
+typedef struct {
+ u32 handle; /* 0 */
+ u32 __pad;
+ memory_t shmem_frame; /* 8 */
+ MEMORY_PADDING;
+} PACKED blkif_fe_interface_connect_t; /* 16 bytes */
+
+/*
+ * CMSG_BLKIF_FE_INTERFACE_DISCONNECT:
+ * If successful, the domain controller will acknowledge with a
+ * STATUS_DISCONNECTED message.
+ */
+typedef struct {
+ u32 handle; /* 0 */
+} PACKED blkif_fe_interface_disconnect_t; /* 4 bytes */
+
+/*
+ * CMSG_BLKIF_FE_INTERFACE_QUERY:
+ */
+typedef struct {
+ /* IN */
+ u32 handle; /* 0 */
+ /* OUT */
+ u32 status; /* 4 */
+ u16 evtchn; /* 8: (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
+ domid_t domid; /* 10: status != BLKIF_INTERFACE_STATUS_DESTROYED */
+} PACKED blkif_fe_interface_query_t; /* 12 bytes */
+
+
+/******************************************************************************
+ * BLOCK-INTERFACE BACKEND DEFINITIONS
+ */
+
+/* Messages from domain controller. */
+#define CMSG_BLKIF_BE_CREATE 0 /* Create a new block-device interface. */
+#define CMSG_BLKIF_BE_DESTROY 1 /* Destroy a block-device interface. */
+#define CMSG_BLKIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
+#define CMSG_BLKIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
+#define CMSG_BLKIF_BE_VBD_CREATE 4 /* Create a new VBD for an interface. */
+#define CMSG_BLKIF_BE_VBD_DESTROY 5 /* Delete a VBD from an interface. */
+#define CMSG_BLKIF_BE_VBD_GROW 6 /* Append an extent to a given VBD. */
+#define CMSG_BLKIF_BE_VBD_SHRINK 7 /* Remove last extent from a given VBD. */
+
+/* Messages to domain controller. */
+#define CMSG_BLKIF_BE_DRIVER_STATUS 32
+
+/*
+ * Message request/response definitions for block-device messages.
+ */
+
+typedef struct {
+ blkif_sector_t sector_start; /* 0 */
+ blkif_sector_t sector_length; /* 8 */
+ blkif_pdev_t device; /* 16 */
+ u16 __pad; /* 18 */
+} PACKED blkif_extent_t; /* 20 bytes */
+
+/* Non-specific 'okay' return. */
+#define BLKIF_BE_STATUS_OKAY 0
+/* Non-specific 'error' return. */
+#define BLKIF_BE_STATUS_ERROR 1
+/* The following are specific error returns. */
+#define BLKIF_BE_STATUS_INTERFACE_EXISTS 2
+#define BLKIF_BE_STATUS_INTERFACE_NOT_FOUND 3
+#define BLKIF_BE_STATUS_INTERFACE_CONNECTED 4
+#define BLKIF_BE_STATUS_VBD_EXISTS 5
+#define BLKIF_BE_STATUS_VBD_NOT_FOUND 6
+#define BLKIF_BE_STATUS_OUT_OF_MEMORY 7
+#define BLKIF_BE_STATUS_EXTENT_NOT_FOUND 8
+#define BLKIF_BE_STATUS_MAPPING_ERROR 9
+
+/* This macro can be used to create an array of descriptive error strings. */
+#define BLKIF_BE_STATUS_ERRORS { \
+ "Okay", \
+ "Non-specific error", \
+ "Interface already exists", \
+ "Interface not found", \
+ "Interface is still connected", \
+ "VBD already exists", \
+ "VBD not found", \
+ "Out of memory", \
+ "Extent not found for VBD", \
+ "Could not map domain memory" }
+
+/*
+ * CMSG_BLKIF_BE_CREATE:
+ * When the driver sends a successful response then the interface is fully
+ * created. The controller will send a DOWN notification to the front-end
+ * driver.
+ */
+typedef struct {
+ /* IN */
+ domid_t domid; /* 0: Domain attached to new interface. */
+ u16 __pad;
+ u32 blkif_handle; /* 4: Domain-specific interface handle. */
+ /* OUT */
+ u32 status; /* 8 */
+} PACKED blkif_be_create_t; /* 12 bytes */
+
+/*
+ * CMSG_BLKIF_BE_DESTROY:
+ * When the driver sends a successful response then the interface is fully
+ * torn down. The controller will send a DESTROYED notification to the
+ * front-end driver.
+ */
+typedef struct {
+ /* IN */
+ domid_t domid; /* 0: Identify interface to be destroyed. */
+ u16 __pad;
+ u32 blkif_handle; /* 4: ...ditto... */
+ /* OUT */
+ u32 status; /* 8 */
+} PACKED blkif_be_destroy_t; /* 12 bytes */
+
+/*
+ * CMSG_BLKIF_BE_CONNECT:
+ * When the driver sends a successful response then the interface is fully
+ * connected. The controller will send a CONNECTED notification to the
+ * front-end driver.
+ */
+typedef struct {
+ /* IN */
+ domid_t domid; /* 0: Domain attached to new interface. */
+ u16 __pad;
+ u32 blkif_handle; /* 4: Domain-specific interface handle. */
+ memory_t shmem_frame; /* 8: Page cont. shared comms window. */
+ MEMORY_PADDING;
+ u32 evtchn; /* 16: Event channel for notifications. */
+ /* OUT */
+ u32 status; /* 20 */
+} PACKED blkif_be_connect_t; /* 24 bytes */
+
+/*
+ * CMSG_BLKIF_BE_DISCONNECT:
+ * When the driver sends a successful response then the interface is fully
+ * disconnected. The controller will send a DOWN notification to the front-end
+ * driver.
+ */
+typedef struct {
+ /* IN */
+ domid_t domid; /* 0: Domain attached to new interface. */
+ u16 __pad;
+ u32 blkif_handle; /* 4: Domain-specific interface handle. */
+ /* OUT */
+ u32 status; /* 8 */
+} PACKED blkif_be_disconnect_t; /* 12 bytes */
+
+/* CMSG_BLKIF_BE_VBD_CREATE */
+typedef struct {
+ /* IN */
+ domid_t domid; /* 0: Identify blkdev interface. */
+ u16 __pad;
+ u32 blkif_handle; /* 4: ...ditto... */
+ blkif_vdev_t vdevice; /* 8: Interface-specific id for this VBD. */
+ u16 readonly; /* 10: Non-zero -> VBD isn't writable. */
+ /* OUT */
+ u32 status; /* 12 */
+} PACKED blkif_be_vbd_create_t; /* 16 bytes */
+
+/* CMSG_BLKIF_BE_VBD_DESTROY */
+typedef struct {
+ /* IN */
+ domid_t domid; /* 0: Identify blkdev interface. */
+ u16 __pad0; /* 2 */
+ u32 blkif_handle; /* 4: ...ditto... */
+ blkif_vdev_t vdevice; /* 8: Interface-specific id of the VBD. */
+ u16 __pad1; /* 10 */
+ /* OUT */
+ u32 status; /* 12 */
+} PACKED blkif_be_vbd_destroy_t; /* 16 bytes */
+
+/* CMSG_BLKIF_BE_VBD_GROW */
+typedef struct {
+ /* IN */
+ domid_t domid; /* 0: Identify blkdev interface. */
+ u16 __pad0; /* 2 */
+ u32 blkif_handle; /* 4: ...ditto... */
+ blkif_extent_t extent; /* 8: Physical extent to append to VBD. */
+ blkif_vdev_t vdevice; /* 28: Interface-specific id of the VBD. */
+ u16 __pad1; /* 30 */
+ /* OUT */
+ u32 status; /* 32 */
+} PACKED blkif_be_vbd_grow_t; /* 36 bytes */
+
+/* CMSG_BLKIF_BE_VBD_SHRINK */
+typedef struct {
+ /* IN */
+ domid_t domid; /* 0: Identify blkdev interface. */
+ u16 __pad0; /* 2 */
+ u32 blkif_handle; /* 4: ...ditto... */
+ blkif_vdev_t vdevice; /* 8: Interface-specific id of the VBD. */
+ u16 __pad1; /* 10 */
+ /* OUT */
+ u32 status; /* 12 */
+} PACKED blkif_be_vbd_shrink_t; /* 16 bytes */
+
+/*
+ * CMSG_BLKIF_BE_DRIVER_STATUS:
+ * Notify the domain controller that the back-end driver is DOWN or UP.
+ * If the driver goes DOWN while interfaces are still UP, the controller
+ * will automatically send DOWN notifications.
+ */
+typedef struct {
+ u32 status; /* 0: BLKIF_DRIVER_STATUS_??? */
+} PACKED blkif_be_driver_status_t; /* 4 bytes */
+
+
+/******************************************************************************
+ * NETWORK-INTERFACE FRONTEND DEFINITIONS
+ */
+
+/* Messages from domain controller to guest. */
+#define CMSG_NETIF_FE_INTERFACE_STATUS 0
+
+/* Messages from guest to domain controller. */
+#define CMSG_NETIF_FE_DRIVER_STATUS 32
+#define CMSG_NETIF_FE_INTERFACE_CONNECT 33
+#define CMSG_NETIF_FE_INTERFACE_DISCONNECT 34
+#define CMSG_NETIF_FE_INTERFACE_QUERY 35
+
+/*
+ * CMSG_NETIF_FE_INTERFACE_STATUS:
+ * Notify a guest about a status change on one of its network interfaces.
+ * If the interface is CLOSED or DOWN then the interface is disconnected:
+ * 1. The shared-memory frame is available for reuse.
+ * 2. Any unacknowledged messgaes pending on the interface were dropped.
+ */
+#define NETIF_INTERFACE_STATUS_CLOSED 0 /* Interface doesn't exist. */
+#define NETIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
+#define NETIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
+#define NETIF_INTERFACE_STATUS_CHANGED 3 /* A device has been added or removed. */
+typedef struct {
+ u32 handle; /* 0 */
+ u32 status; /* 4 */
+ u16 evtchn; /* 8: status == NETIF_INTERFACE_STATUS_CONNECTED */
+ u8 mac[6]; /* 10: status == NETIF_INTERFACE_STATUS_CONNECTED */
+ domid_t domid; /* 16: status != NETIF_INTERFACE_STATUS_DESTROYED */
+} PACKED netif_fe_interface_status_t; /* 18 bytes */
+
+/*
+ * CMSG_NETIF_FE_DRIVER_STATUS:
+ * Notify the domain controller that the front-end driver is DOWN or UP.
+ * When the driver goes DOWN then the controller will send no more
+ * status-change notifications.
+ * If the driver goes DOWN while interfaces are still UP, the domain
+ * will automatically take the interfaces DOWN.
+ *
+ * NB. The controller should not send an INTERFACE_STATUS message
+ * for interfaces that are active when it receives an UP notification. We
+ * expect that the frontend driver will query those interfaces itself.
+ */
+#define NETIF_DRIVER_STATUS_DOWN 0
+#define NETIF_DRIVER_STATUS_UP 1
+typedef struct {
+ /* IN */
+ u32 status; /* 0: NETIF_DRIVER_STATUS_??? */
+ /* OUT */
+ /* Driver should query interfaces [0..max_handle]. */
+ u32 max_handle; /* 4 */
+} PACKED netif_fe_driver_status_t; /* 8 bytes */
+
+/*
+ * CMSG_NETIF_FE_INTERFACE_CONNECT:
+ * If successful, the domain controller will acknowledge with a
+ * STATUS_CONNECTED message.
+ */
+typedef struct {
+ u32 handle; /* 0 */
+ u32 __pad; /* 4 */
+ memory_t tx_shmem_frame; /* 8 */
+ MEMORY_PADDING;
+ memory_t rx_shmem_frame; /* 16 */
+ MEMORY_PADDING;
+} PACKED netif_fe_interface_connect_t; /* 24 bytes */
+
+/*
+ * CMSG_NETIF_FE_INTERFACE_DISCONNECT:
+ * If successful, the domain controller will acknowledge with a
+ * STATUS_DISCONNECTED message.
+ */
+typedef struct {
+ u32 handle; /* 0 */
+} PACKED netif_fe_interface_disconnect_t; /* 4 bytes */
+
+/*
+ * CMSG_NETIF_FE_INTERFACE_QUERY:
+ */
+typedef struct {
+ /* IN */
+ u32 handle; /* 0 */
+ /* OUT */
+ u32 status; /* 4 */
+ u16 evtchn; /* 8: status == NETIF_INTERFACE_STATUS_CONNECTED */
+ u8 mac[6]; /* 10: status == NETIF_INTERFACE_STATUS_CONNECTED */
+ domid_t domid; /* 16: status != NETIF_INTERFACE_STATUS_DESTROYED */
+} PACKED netif_fe_interface_query_t; /* 18 bytes */
+
+
+/******************************************************************************
+ * NETWORK-INTERFACE BACKEND DEFINITIONS
+ */
+
+/* Messages from domain controller. */
+#define CMSG_NETIF_BE_CREATE 0 /* Create a new net-device interface. */
+#define CMSG_NETIF_BE_DESTROY 1 /* Destroy a net-device interface. */
+#define CMSG_NETIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
+#define CMSG_NETIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
+
+/* Messages to domain controller. */
+#define CMSG_NETIF_BE_DRIVER_STATUS 32
+
+/*
+ * Message request/response definitions for net-device messages.
+ */
+
+/* Non-specific 'okay' return. */
+#define NETIF_BE_STATUS_OKAY 0
+/* Non-specific 'error' return. */
+#define NETIF_BE_STATUS_ERROR 1
+/* The following are specific error returns. */
+#define NETIF_BE_STATUS_INTERFACE_EXISTS 2
+#define NETIF_BE_STATUS_INTERFACE_NOT_FOUND 3
+#define NETIF_BE_STATUS_INTERFACE_CONNECTED 4
+#define NETIF_BE_STATUS_OUT_OF_MEMORY 5
+#define NETIF_BE_STATUS_MAPPING_ERROR 6
+
+/* This macro can be used to create an array of descriptive error strings. */
+#define NETIF_BE_STATUS_ERRORS { \
+ "Okay", \
+ "Non-specific error", \
+ "Interface already exists", \
+ "Interface not found", \
+ "Interface is still connected", \
+ "Out of memory", \
+ "Could not map domain memory" }
+
+/*
+ * CMSG_NETIF_BE_CREATE:
+ * When the driver sends a successful response then the interface is fully
+ * created. The controller will send a DOWN notification to the front-end
+ * driver.
+ */
+typedef struct {
+ /* IN */
+ domid_t domid; /* 0: Domain attached to new interface. */
+ u16 __pad0; /* 2 */
+ u32 netif_handle; /* 4: Domain-specific interface handle. */
+ u8 mac[6]; /* 8 */
+ u16 __pad1; /* 14 */
+ /* OUT */
+ u32 status; /* 16 */
+} PACKED netif_be_create_t; /* 20 bytes */
+
+/*
+ * CMSG_NETIF_BE_DESTROY:
+ * When the driver sends a successful response then the interface is fully
+ * torn down. The controller will send a DESTROYED notification to the
+ * front-end driver.
+ */
+typedef struct {
+ /* IN */
+ domid_t domid; /* 0: Identify interface to be destroyed. */
+ u16 __pad;
+ u32 netif_handle; /* 4: ...ditto... */
+ /* OUT */
+ u32 status; /* 8 */
+} PACKED netif_be_destroy_t; /* 12 bytes */
+
+/*
+ * CMSG_NETIF_BE_CONNECT:
+ * When the driver sends a successful response then the interface is fully
+ * connected. The controller will send a CONNECTED notification to the
+ * front-end driver.
+ */
+typedef struct {
+ /* IN */
+ domid_t domid; /* 0: Domain attached to new interface. */
+ u16 __pad0; /* 2 */
+ u32 netif_handle; /* 4: Domain-specific interface handle. */
+ memory_t tx_shmem_frame; /* 8: Page cont. tx shared comms window. */
+ MEMORY_PADDING;
+ memory_t rx_shmem_frame; /* 16: Page cont. rx shared comms window. */
+ MEMORY_PADDING;
+ u16 evtchn; /* 24: Event channel for notifications. */
+ u16 __pad1; /* 26 */
+ /* OUT */
+ u32 status; /* 28 */
+} PACKED netif_be_connect_t; /* 32 bytes */
+
+/*
+ * CMSG_NETIF_BE_DISCONNECT:
+ * When the driver sends a successful response then the interface is fully
+ * disconnected. The controller will send a DOWN notification to the front-end
+ * driver.
+ */
+typedef struct {
+ /* IN */
+ domid_t domid; /* 0: Domain attached to new interface. */
+ u16 __pad;
+ u32 netif_handle; /* 4: Domain-specific interface handle. */
+ /* OUT */
+ u32 status; /* 8 */
+} PACKED netif_be_disconnect_t; /* 12 bytes */
+
+/*
+ * CMSG_NETIF_BE_DRIVER_STATUS:
+ * Notify the domain controller that the back-end driver is DOWN or UP.
+ * If the driver goes DOWN while interfaces are still UP, the domain
+ * will automatically send DOWN notifications.
+ */
+typedef struct {
+ u32 status; /* 0: NETIF_DRIVER_STATUS_??? */
+} PACKED netif_be_driver_status_t; /* 4 bytes */
+
+
+/******************************************************************************
+ * SHUTDOWN DEFINITIONS
+ */
+
+/*
+ * Subtypes for shutdown messages.
+ */
+#define CMSG_SHUTDOWN_POWEROFF 0 /* Clean shutdown (SHUTDOWN_poweroff). */
+#define CMSG_SHUTDOWN_REBOOT 1 /* Clean shutdown (SHUTDOWN_reboot). */
+#define CMSG_SHUTDOWN_SUSPEND 2 /* Create suspend info, then */
+ /* SHUTDOWN_suspend. */
+
+
+/******************************************************************************
+ * MEMORY CONTROLS
+ */
+
+#define CMSG_MEM_REQUEST_SET 0 /* Request a domain to set its mem footprint. */
+
+/*
+ * CMSG_MEM_REQUEST:
+ * Request that the domain change its memory reservation.
+ */
+typedef struct {
+ /* OUT */
+ u32 target; /* 0: Target memory reservation in pages. */
+ /* IN */
+ u32 status; /* 4: Return code indicates success or failure. */
+} PACKED mem_request_t; /* 8 bytes */
+
+
+#endif /* __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__ */
--- /dev/null
+/******************************************************************************
+ * netif.h
+ *
+ * Unified network-device I/O interface for Xen guest OSes.
+ *
+ * Copyright (c) 2003-2004, Keir Fraser
+ */
+
+#ifndef __XEN_PUBLIC_IO_NETIF_H__
+#define __XEN_PUBLIC_IO_NETIF_H__
+
+typedef struct {
+ memory_t addr; /* 0: Machine address of packet. */
+ MEMORY_PADDING;
+ u16 id; /* 8: Echoed in response message. */
+ u16 size; /* 10: Packet size in bytes. */
+} PACKED netif_tx_request_t; /* 12 bytes */
+
+typedef struct {
+ u16 id; /* 0 */
+ s8 status; /* 2 */
+ u8 __pad; /* 3 */
+} PACKED netif_tx_response_t; /* 4 bytes */
+
+typedef struct {
+ u16 id; /* 0: Echoed in response message. */
+} PACKED netif_rx_request_t; /* 2 bytes */
+
+typedef struct {
+ memory_t addr; /* 0: Machine address of packet. */
+ MEMORY_PADDING;
+ u16 id; /* 8: */
+ s16 status; /* 10: -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
+} PACKED netif_rx_response_t; /* 12 bytes */
+
+/*
+ * We use a special capitalised type name because it is _essential_ that all
+ * arithmetic on indexes is done on an integer type of the correct size.
+ */
+typedef u32 NETIF_RING_IDX;
+
+/*
+ * Ring indexes are 'free running'. That is, they are not stored modulo the
+ * size of the ring buffer. The following macros convert a free-running counter
+ * into a value that can directly index a ring-buffer array.
+ */
+#define MASK_NETIF_RX_IDX(_i) ((_i)&(NETIF_RX_RING_SIZE-1))
+#define MASK_NETIF_TX_IDX(_i) ((_i)&(NETIF_TX_RING_SIZE-1))
+
+#define NETIF_TX_RING_SIZE 256
+#define NETIF_RX_RING_SIZE 256
+
+/* This structure must fit in a memory page. */
+typedef struct {
+ /*
+ * Frontend places packets into ring at tx_req_prod.
+ * Frontend receives event when tx_resp_prod passes tx_event.
+ * 'req_cons' is a shadow of the backend's request consumer -- the frontend
+ * may use it to determine if all queued packets have been seen by the
+ * backend.
+ */
+ NETIF_RING_IDX req_prod; /* 0 */
+ NETIF_RING_IDX req_cons; /* 4 */
+ NETIF_RING_IDX resp_prod; /* 8 */
+ NETIF_RING_IDX event; /* 12 */
+ union { /* 16 */
+ netif_tx_request_t req;
+ netif_tx_response_t resp;
+ } PACKED ring[NETIF_TX_RING_SIZE];
+} PACKED netif_tx_interface_t;
+
+/* This structure must fit in a memory page. */
+typedef struct {
+ /*
+ * Frontend places empty buffers into ring at rx_req_prod.
+ * Frontend receives event when rx_resp_prod passes rx_event.
+ */
+ NETIF_RING_IDX req_prod; /* 0 */
+ NETIF_RING_IDX resp_prod; /* 4 */
+ NETIF_RING_IDX event; /* 8 */
+ union { /* 12 */
+ netif_rx_request_t req;
+ netif_rx_response_t resp;
+ } PACKED ring[NETIF_RX_RING_SIZE];
+} PACKED netif_rx_interface_t;
+
+/* Descriptor status values */
+#define NETIF_RSP_DROPPED -2
+#define NETIF_RSP_ERROR -1
+#define NETIF_RSP_OKAY 0
+
+#endif
--- /dev/null
+/* -*- Mode:C; c-basic-offset:4; tab-width:4 -*-
+ ****************************************************************************
+ * (c) 2004 - Rolf Neugebauer - Intel Research Cambridge
+ * (c) 2004 - Keir Fraser - University of Cambridge
+ ****************************************************************************
+ * Description: Interface for domains to access physical devices on the PCI bus
+ */
+
+#ifndef __XEN_PUBLIC_PHYSDEV_H__
+#define __XEN_PUBLIC_PHYSDEV_H__
+
+/* Commands to HYPERVISOR_physdev_op() */
+#define PHYSDEVOP_PCI_CFGREG_READ 0
+#define PHYSDEVOP_PCI_CFGREG_WRITE 1
+#define PHYSDEVOP_PCI_INITIALISE_DEVICE 2
+#define PHYSDEVOP_PCI_PROBE_ROOT_BUSES 3
+#define PHYSDEVOP_IRQ_UNMASK_NOTIFY 4
+#define PHYSDEVOP_IRQ_STATUS_QUERY 5
+
+/* Read from PCI configuration space. */
+typedef struct {
+ /* IN */
+ u32 bus; /* 0 */
+ u32 dev; /* 4 */
+ u32 func; /* 8 */
+ u32 reg; /* 12 */
+ u32 len; /* 16 */
+ /* OUT */
+ u32 value; /* 20 */
+} PACKED physdevop_pci_cfgreg_read_t; /* 24 bytes */
+
+/* Write to PCI configuration space. */
+typedef struct {
+ /* IN */
+ u32 bus; /* 0 */
+ u32 dev; /* 4 */
+ u32 func; /* 8 */
+ u32 reg; /* 12 */
+ u32 len; /* 16 */
+ u32 value; /* 20 */
+} PACKED physdevop_pci_cfgreg_write_t; /* 24 bytes */
+
+/* Do final initialisation of a PCI device (e.g., last-moment IRQ routing). */
+typedef struct {
+ /* IN */
+ u32 bus; /* 0 */
+ u32 dev; /* 4 */
+ u32 func; /* 8 */
+} PACKED physdevop_pci_initialise_device_t; /* 12 bytes */
+
+/* Find the root buses for subsequent scanning. */
+typedef struct {
+ /* OUT */
+ u32 busmask[256/32]; /* 0 */
+} PACKED physdevop_pci_probe_root_buses_t; /* 32 bytes */
+
+typedef struct {
+ /* IN */
+ u32 irq; /* 0 */
+ /* OUT */
+/* Need to call PHYSDEVOP_IRQ_UNMASK_NOTIFY when the IRQ has been serviced? */
+#define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY (1<<0)
+ u32 flags; /* 4 */
+} PACKED physdevop_irq_status_query_t; /* 8 bytes */
+
+typedef struct _physdev_op_st
+{
+ u32 cmd; /* 0 */
+ u32 __pad; /* 4 */
+ union { /* 8 */
+ physdevop_pci_cfgreg_read_t pci_cfgreg_read;
+ physdevop_pci_cfgreg_write_t pci_cfgreg_write;
+ physdevop_pci_initialise_device_t pci_initialise_device;
+ physdevop_pci_probe_root_buses_t pci_probe_root_buses;
+ physdevop_irq_status_query_t irq_status_query;
+ u8 __dummy[32];
+ } PACKED u;
+} PACKED physdev_op_t; /* 40 bytes */
+
+#endif /* __XEN_PUBLIC_PHYSDEV_H__ */
--- /dev/null
+/**
+ * Generic scheduler control interface.
+ *
+ * Mark Williamson, (C) 2004 Intel Research Cambridge
+ */
+
+#ifndef __XEN_PUBLIC_SCHED_CTL_H__
+#define __XEN_PUBLIC_SCHED_CTL_H__
+
+/* Scheduler types */
+#define SCHED_BVT 0
+#define SCHED_ATROPOS 2
+#define SCHED_RROBIN 3
+
+/* these describe the intended direction used for a scheduler control or domain
+ * command */
+#define SCHED_INFO_PUT 0
+#define SCHED_INFO_GET 1
+
+/*
+ * Generic scheduler control command - used to adjust system-wide scheduler
+ * parameters
+ */
+struct sched_ctl_cmd
+{
+ u32 sched_id; /* 0 */
+ u32 direction; /* 4 */
+ union { /* 8 */
+ struct bvt_ctl
+ {
+ /* IN variables. */
+ u32 ctx_allow; /* 8: context switch allowance */
+ } PACKED bvt;
+
+ struct rrobin_ctl
+ {
+ /* IN variables */
+ u64 slice; /* 8: round robin time slice */
+ } PACKED rrobin;
+ } PACKED u;
+} PACKED; /* 16 bytes */
+
+struct sched_adjdom_cmd
+{
+ u32 sched_id; /* 0 */
+ u32 direction; /* 4 */
+ domid_t domain; /* 8 */
+ u16 __pad0;
+ u32 __pad1;
+ union { /* 16 */
+ struct bvt_adjdom
+ {
+ u32 mcu_adv; /* 16: mcu advance: inverse of weight */
+ u32 warpback; /* 20: warp? */
+ s32 warpvalue; /* 24: warp value */
+ long long warpl; /* 32: warp limit */
+ long long warpu; /* 40: unwarp time requirement */
+ } PACKED bvt;
+
+ struct atropos_adjdom
+ {
+ u64 nat_period; /* 16 */
+ u64 nat_slice; /* 24 */
+ u64 latency; /* 32 */
+ u32 xtratime; /* 36 */
+ } PACKED atropos;
+ } PACKED u;
+} PACKED; /* 40 bytes */
+
+#endif /* __XEN_PUBLIC_SCHED_CTL_H__ */
--- /dev/null
+/******************************************************************************
+ * trace.h
+ */
+
+#ifndef __XEN_PUBLIC_TRACE_H__
+#define __XEN_PUBLIC_TRACE_H__
+
+/* This structure represents a single trace buffer record. */
+struct t_rec {
+ u64 cycles; /* 64 bit cycle counter timestamp */
+ u32 event; /* 32 bit event ID */
+ u32 d1, d2, d3, d4, d5; /* event data items */
+};
+
+/*
+ * This structure contains the metadata for a single trace buffer. The head
+ * field, indexes into an array of struct t_rec's.
+ */
+struct t_buf {
+ unsigned long data; /* pointer to data area. machine address
+ * for convenience in user space code */
+
+ unsigned long size; /* size of the data area, in t_recs */
+ unsigned long head; /* array index of the most recent record */
+
+ /* Xen-private elements follow... */
+ struct t_rec *head_ptr; /* pointer to the head record */
+ struct t_rec *vdata; /* virtual address pointer to data */
+};
+
+#endif /* __XEN_PUBLIC_TRACE_H__ */
--- /dev/null
+/******************************************************************************
+ * xen.h
+ *
+ * Guest OS interface to Xen.
+ *
+ * Copyright (c) 2004, K A Fraser
+ */
+
+#ifndef __XEN_PUBLIC_XEN_H__
+#define __XEN_PUBLIC_XEN_H__
+
+/* GCC-specific way to pack structure definitions (no implicit padding). */
+#define PACKED __attribute__ ((packed))
+
+#if defined(__i386__)
+#include "arch-x86_32.h"
+#elif defined(__x86_64__)
+#include "arch-x86_64.h"
+#else
+#error "Unsupported architecture"
+#endif
+
+/*
+ * XEN "SYSTEM CALLS" (a.k.a. HYPERCALLS).
+ */
+
+/* EAX = vector; EBX, ECX, EDX, ESI, EDI = args 1, 2, 3, 4, 5. */
+#define __HYPERVISOR_set_trap_table 0
+#define __HYPERVISOR_mmu_update 1
+#define __HYPERVISOR_set_gdt 2
+#define __HYPERVISOR_stack_switch 3
+#define __HYPERVISOR_set_callbacks 4
+#define __HYPERVISOR_fpu_taskswitch 5
+#define __HYPERVISOR_sched_op 6
+#define __HYPERVISOR_dom0_op 7
+#define __HYPERVISOR_set_debugreg 8
+#define __HYPERVISOR_get_debugreg 9
+#define __HYPERVISOR_update_descriptor 10
+#define __HYPERVISOR_set_fast_trap 11
+#define __HYPERVISOR_dom_mem_op 12
+#define __HYPERVISOR_multicall 13
+#define __HYPERVISOR_update_va_mapping 14
+#define __HYPERVISOR_set_timer_op 15
+#define __HYPERVISOR_event_channel_op 16
+#define __HYPERVISOR_xen_version 17
+#define __HYPERVISOR_console_io 18
+#define __HYPERVISOR_physdev_op 19
+#define __HYPERVISOR_grant_table_op 20
+#define __HYPERVISOR_vm_assist 21
+#define __HYPERVISOR_update_va_mapping_otherdomain 22
+
+/*
+ * MULTICALLS
+ *
+ * Multicalls are listed in an array, with each element being a fixed size
+ * (BYTES_PER_MULTICALL_ENTRY). Each is of the form (op, arg1, ..., argN)
+ * where each element of the tuple is a machine word.
+ */
+#define ARGS_PER_MULTICALL_ENTRY 8
+
+
+/*
+ * VIRTUAL INTERRUPTS
+ *
+ * Virtual interrupts that a guest OS may receive from Xen.
+ */
+#define VIRQ_MISDIRECT 0 /* Catch-all interrupt for unbound VIRQs. */
+#define VIRQ_TIMER 1 /* Timebase update, and/or requested timeout. */
+#define VIRQ_DEBUG 2 /* Request guest to dump debug info. */
+#define VIRQ_CONSOLE 3 /* (DOM0) bytes received on emergency console. */
+#define VIRQ_DOM_EXC 4 /* (DOM0) Exceptional event for some domain. */
+#define VIRQ_PARITY_ERR 5 /* (DOM0) NMI parity error. */
+#define VIRQ_IO_ERR 6 /* (DOM0) NMI I/O error. */
+#define NR_VIRQS 7
+
+/*
+ * MMU-UPDATE REQUESTS
+ *
+ * HYPERVISOR_mmu_update() accepts a list of (ptr, val) pairs.
+ * ptr[1:0] specifies the appropriate MMU_* command.
+ *
+ * FOREIGN DOMAIN (FD)
+ * -------------------
+ * Some commands recognise an explicitly-declared foreign domain,
+ * in which case they will operate with respect to the foreigner rather than
+ * the calling domain. Where the FD has some effect, it is described below.
+ *
+ * ptr[1:0] == MMU_NORMAL_PT_UPDATE:
+ * Updates an entry in a page table. If updating an L1 table, and the new
+ * table entry is valid/present, the mapped frame must belong to the FD, if
+ * an FD has been specified. If attempting to map an I/O page then the
+ * caller assumes the privilege of the FD.
+ * FD == DOMID_IO: Permit /only/ I/O mappings, at the priv level of the caller.
+ * FD == DOMID_XEN: Map restricted areas of Xen's heap space.
+ * ptr[:2] -- Machine address of the page-table entry to modify.
+ * val -- Value to write.
+ *
+ * ptr[1:0] == MMU_MACHPHYS_UPDATE:
+ * Updates an entry in the machine->pseudo-physical mapping table.
+ * ptr[:2] -- Machine address within the frame whose mapping to modify.
+ * The frame must belong to the FD, if one is specified.
+ * val -- Value to write into the mapping entry.
+ *
+ * ptr[1:0] == MMU_EXTENDED_COMMAND:
+ * val[7:0] -- MMUEXT_* command.
+ *
+ * val[7:0] == MMUEXT_(UN)PIN_*_TABLE:
+ * ptr[:2] -- Machine address of frame to be (un)pinned as a p.t. page.
+ * The frame must belong to the FD, if one is specified.
+ *
+ * val[7:0] == MMUEXT_NEW_BASEPTR:
+ * ptr[:2] -- Machine address of new page-table base to install in MMU.
+ *
+ * val[7:0] == MMUEXT_TLB_FLUSH:
+ * No additional arguments.
+ *
+ * val[7:0] == MMUEXT_INVLPG:
+ * ptr[:2] -- Linear address to be flushed from the TLB.
+ *
+ * val[7:0] == MMUEXT_FLUSH_CACHE:
+ * No additional arguments. Writes back and flushes cache contents.
+ *
+ * val[7:0] == MMUEXT_SET_LDT:
+ * ptr[:2] -- Linear address of LDT base (NB. must be page-aligned).
+ * val[:8] -- Number of entries in LDT.
+ *
+ * val[7:0] == MMUEXT_TRANSFER_PAGE:
+ * val[31:16] -- Domain to whom page is to be transferred.
+ * (val[15:8],ptr[9:2]) -- 16-bit reference into transferee's grant table.
+ * ptr[:12] -- Page frame to be reassigned to the FD.
+ * (NB. The frame must currently belong to the calling domain).
+ *
+ * val[7:0] == MMUEXT_SET_FOREIGNDOM:
+ * val[31:16] -- Domain to set as the Foreign Domain (FD).
+ * (NB. DOMID_SELF is not recognised)
+ * If FD != DOMID_IO then the caller must be privileged.
+ *
+ * val[7:0] == MMUEXT_CLEAR_FOREIGNDOM:
+ * Clears the FD.
+ *
+ * val[7:0] == MMUEXT_REASSIGN_PAGE:
+ * ptr[:2] -- A machine address within the page to be reassigned to the FD.
+ * (NB. page must currently belong to the calling domain).
+ */
+#define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */
+#define MMU_MACHPHYS_UPDATE 2 /* ptr = MA of frame to modify entry for */
+#define MMU_EXTENDED_COMMAND 3 /* least 8 bits of val demux further */
+#define MMUEXT_PIN_L1_TABLE 0 /* ptr = MA of frame to pin */
+#define MMUEXT_PIN_L2_TABLE 1 /* ptr = MA of frame to pin */
+#define MMUEXT_PIN_L3_TABLE 2 /* ptr = MA of frame to pin */
+#define MMUEXT_PIN_L4_TABLE 3 /* ptr = MA of frame to pin */
+#define MMUEXT_UNPIN_TABLE 4 /* ptr = MA of frame to unpin */
+#define MMUEXT_NEW_BASEPTR 5 /* ptr = MA of new pagetable base */
+#define MMUEXT_TLB_FLUSH 6 /* ptr = NULL */
+#define MMUEXT_INVLPG 7 /* ptr = VA to invalidate */
+#define MMUEXT_FLUSH_CACHE 8
+#define MMUEXT_SET_LDT 9 /* ptr = VA of table; val = # entries */
+#define MMUEXT_SET_FOREIGNDOM 10 /* val[31:16] = dom */
+#define MMUEXT_CLEAR_FOREIGNDOM 11
+#define MMUEXT_TRANSFER_PAGE 12 /* ptr = MA of frame; val[31:16] = dom */
+#define MMUEXT_REASSIGN_PAGE 13
+#define MMUEXT_CMD_MASK 255
+#define MMUEXT_CMD_SHIFT 8
+
+/* These are passed as 'flags' to update_va_mapping. They can be ORed. */
+#define UVMF_FLUSH_TLB 1 /* Flush entire TLB. */
+#define UVMF_INVLPG 2 /* Flush the VA mapping being updated. */
+
+
+/*
+ * Commands to HYPERVISOR_sched_op().
+ */
+#define SCHEDOP_yield 0 /* Give up the CPU voluntarily. */
+#define SCHEDOP_block 1 /* Block until an event is received. */
+#define SCHEDOP_shutdown 2 /* Stop executing this domain. */
+#define SCHEDOP_cmdmask 255 /* 8-bit command. */
+#define SCHEDOP_reasonshift 8 /* 8-bit reason code. (SCHEDOP_shutdown) */
+
+/*
+ * Commands to HYPERVISOR_console_io().
+ */
+#define CONSOLEIO_write 0
+#define CONSOLEIO_read 1
+
+/*
+ * Commands to HYPERVISOR_dom_mem_op().
+ */
+#define MEMOP_increase_reservation 0
+#define MEMOP_decrease_reservation 1
+
+/*
+ * Commands to HYPERVISOR_vm_assist().
+ */
+#define VMASST_CMD_enable 0
+#define VMASST_CMD_disable 1
+#define VMASST_TYPE_4gb_segments 0
+#define VMASST_TYPE_4gb_segments_notify 1
+#define VMASST_TYPE_writable_pagetables 2
+#define MAX_VMASST_TYPE 2
+
+#ifndef __ASSEMBLY__
+
+typedef u16 domid_t;
+
+/* Domain ids >= DOMID_FIRST_RESERVED cannot be used for ordinary domains. */
+#define DOMID_FIRST_RESERVED (0x7FF0U)
+
+/* DOMID_SELF is used in certain contexts to refer to oneself. */
+#define DOMID_SELF (0x7FF0U)
+
+/*
+ * DOMID_IO is used to restrict page-table updates to mapping I/O memory.
+ * Although no Foreign Domain need be specified to map I/O pages, DOMID_IO
+ * is useful to ensure that no mappings to the OS's own heap are accidentally
+ * installed. (e.g., in Linux this could cause havoc as reference counts
+ * aren't adjusted on the I/O-mapping code path).
+ * This only makes sense in MMUEXT_SET_FOREIGNDOM, but in that context can
+ * be specified by any calling domain.
+ */
+#define DOMID_IO (0x7FF1U)
+
+/*
+ * DOMID_XEN is used to allow privileged domains to map restricted parts of
+ * Xen's heap space (e.g., the machine_to_phys table).
+ * This only makes sense in MMUEXT_SET_FOREIGNDOM, and is only permitted if
+ * the caller is privileged.
+ */
+#define DOMID_XEN (0x7FF2U)
+
+/*
+ * Send an array of these to HYPERVISOR_mmu_update().
+ * NB. The fields are natural pointer/address size for this architecture.
+ */
+typedef struct
+{
+ memory_t ptr; /* Machine address of PTE. */
+ memory_t val; /* New contents of PTE. */
+} PACKED mmu_update_t;
+
+/*
+ * Send an array of these to HYPERVISOR_multicall().
+ * NB. The fields are natural register size for this architecture.
+ */
+typedef struct
+{
+ cpureg_t op;
+ cpureg_t args[7];
+} PACKED multicall_entry_t;
+
+/* Event channel endpoints per domain. */
+#define NR_EVENT_CHANNELS 1024
+
+/* No support for multi-processor guests. */
+#define MAX_VIRT_CPUS 1
+
+/*
+ * Xen/guestos shared data -- pointer provided in start_info.
+ * NB. We expect that this struct is smaller than a page.
+ */
+typedef struct shared_info_st
+{
+ /*
+ * Per-VCPU information goes here. This will be cleaned up more when Xen
+ * actually supports multi-VCPU guests.
+ */
+ struct {
+ /*
+ * 'evtchn_upcall_pending' is written non-zero by Xen to indicate
+ * a pending notification for a particular VCPU. It is then cleared
+ * by the guest OS /before/ checking for pending work, thus avoiding
+ * a set-and-check race. Note that the mask is only accessed by Xen
+ * on the CPU that is currently hosting the VCPU. This means that the
+ * pending and mask flags can be updated by the guest without special
+ * synchronisation (i.e., no need for the x86 LOCK prefix).
+ * This may seem suboptimal because if the pending flag is set by
+ * a different CPU then an IPI may be scheduled even when the mask
+ * is set. However, note:
+ * 1. The task of 'interrupt holdoff' is covered by the per-event-
+ * channel mask bits. A 'noisy' event that is continually being
+ * triggered can be masked at source at this very precise
+ * granularity.
+ * 2. The main purpose of the per-VCPU mask is therefore to restrict
+ * reentrant execution: whether for concurrency control, or to
+ * prevent unbounded stack usage. Whatever the purpose, we expect
+ * that the mask will be asserted only for short periods at a time,
+ * and so the likelihood of a 'spurious' IPI is suitably small.
+ * The mask is read before making an event upcall to the guest: a
+ * non-zero mask therefore guarantees that the VCPU will not receive
+ * an upcall activation. The mask is cleared when the VCPU requests
+ * to block: this avoids wakeup-waiting races.
+ */
+ u8 evtchn_upcall_pending;
+ u8 evtchn_upcall_mask;
+ u8 pad0, pad1;
+ } PACKED vcpu_data[MAX_VIRT_CPUS]; /* 0 */
+
+ /*
+ * A domain can have up to 1024 "event channels" on which it can send
+ * and receive asynchronous event notifications. There are three classes
+ * of event that are delivered by this mechanism:
+ * 1. Bi-directional inter- and intra-domain connections. Domains must
+ * arrange out-of-band to set up a connection (usually the setup
+ * is initiated and organised by a privileged third party such as
+ * software running in domain 0).
+ * 2. Physical interrupts. A domain with suitable hardware-access
+ * privileges can bind an event-channel port to a physical interrupt
+ * source.
+ * 3. Virtual interrupts ('events'). A domain can bind an event-channel
+ * port to a virtual interrupt source, such as the virtual-timer
+ * device or the emergency console.
+ *
+ * Event channels are addressed by a "port index" between 0 and 1023.
+ * Each channel is associated with two bits of information:
+ * 1. PENDING -- notifies the domain that there is a pending notification
+ * to be processed. This bit is cleared by the guest.
+ * 2. MASK -- if this bit is clear then a 0->1 transition of PENDING
+ * will cause an asynchronous upcall to be scheduled. This bit is only
+ * updated by the guest. It is read-only within Xen. If a channel
+ * becomes pending while the channel is masked then the 'edge' is lost
+ * (i.e., when the channel is unmasked, the guest must manually handle
+ * pending notifications as no upcall will be scheduled by Xen).
+ *
+ * To expedite scanning of pending notifications, any 0->1 pending
+ * transition on an unmasked channel causes a corresponding bit in a
+ * 32-bit selector to be set. Each bit in the selector covers a 32-bit
+ * word in the PENDING bitfield array.
+ */
+ u32 evtchn_pending[32]; /* 4 */
+ u32 evtchn_pending_sel; /* 132 */
+ u32 evtchn_mask[32]; /* 136 */
+
+ /*
+ * Time: The following abstractions are exposed: System Time, Clock Time,
+ * Domain Virtual Time. Domains can access Cycle counter time directly.
+ */
+ u64 cpu_freq; /* 264: CPU frequency (Hz). */
+
+ /*
+ * The following values are updated periodically (and not necessarily
+ * atomically!). The guest OS detects this because 'time_version1' is
+ * incremented just before updating these values, and 'time_version2' is
+ * incremented immediately after. See the Xen-specific Linux code for an
+ * example of how to read these values safely (arch/xen/kernel/time.c).
+ */
+ u32 time_version1; /* 272 */
+ u32 time_version2; /* 276 */
+ tsc_timestamp_t tsc_timestamp; /* TSC at last update of time vals. */
+ u64 system_time; /* Time, in nanosecs, since boot. */
+ u32 wc_sec; /* Secs 00:00:00 UTC, Jan 1, 1970. */
+ u32 wc_usec; /* Usecs 00:00:00 UTC, Jan 1, 1970. */
+ u64 domain_time; /* Domain virtual time, in nanosecs. */
+
+ /*
+ * Timeout values:
+ * Allow a domain to specify a timeout value in system time and
+ * domain virtual time.
+ */
+ u64 wall_timeout; /* 312 */
+ u64 domain_timeout; /* 320 */
+
+ arch_shared_info_t arch;
+
+} PACKED shared_info_t;
+
+/*
+ * Start-of-day memory layout for the initial domain (DOM0):
+ * 1. The domain is started within contiguous virtual-memory region.
+ * 2. The contiguous region begins and ends on an aligned 4MB boundary.
+ * 3. The region start corresponds to the load address of the OS image.
+ * If the load address is not 4MB aligned then the address is rounded down.
+ * 4. This the order of bootstrap elements in the initial virtual region:
+ * a. relocated kernel image
+ * b. initial ram disk [mod_start, mod_len]
+ * c. list of allocated page frames [mfn_list, nr_pages]
+ * d. bootstrap page tables [pt_base, CR3 (x86)]
+ * e. start_info_t structure [register ESI (x86)]
+ * f. bootstrap stack [register ESP (x86)]
+ * 5. Bootstrap elements are packed together, but each is 4kB-aligned.
+ * 6. The initial ram disk may be omitted.
+ * 7. The list of page frames forms a contiguous 'pseudo-physical' memory
+ * layout for the domain. In particular, the bootstrap virtual-memory
+ * region is a 1:1 mapping to the first section of the pseudo-physical map.
+ * 8. All bootstrap elements are mapped read-writable for the guest OS. The
+ * only exception is the bootstrap page table, which is mapped read-only.
+ * 9. There is guaranteed to be at least 512kB padding after the final
+ * bootstrap element. If necessary, the bootstrap virtual region is
+ * extended by an extra 4MB to ensure this.
+ */
+
+#define MAX_CMDLINE 256
+typedef struct {
+ /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME. */
+ memory_t nr_pages; /* 0: Total pages allocated to this domain. */
+ _MEMORY_PADDING(A);
+ memory_t shared_info; /* 8: MACHINE address of shared info struct.*/
+ _MEMORY_PADDING(B);
+ u32 flags; /* 16: SIF_xxx flags. */
+ u16 domain_controller_evtchn; /* 20 */
+ u16 __pad;
+ /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME). */
+ memory_t pt_base; /* 24: VIRTUAL address of page directory. */
+ _MEMORY_PADDING(C);
+ memory_t nr_pt_frames; /* 32: Number of bootstrap p.t. frames. */
+ _MEMORY_PADDING(D);
+ memory_t mfn_list; /* 40: VIRTUAL address of page-frame list. */
+ _MEMORY_PADDING(E);
+ memory_t mod_start; /* 48: VIRTUAL address of pre-loaded module. */
+ _MEMORY_PADDING(F);
+ memory_t mod_len; /* 56: Size (bytes) of pre-loaded module. */
+ _MEMORY_PADDING(G);
+ u8 cmd_line[MAX_CMDLINE]; /* 64 */
+} PACKED start_info_t; /* 320 bytes */
+
+/* These flags are passed in the 'flags' field of start_info_t. */
+#define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */
+#define SIF_INITDOMAIN (1<<1) /* Is this the initial control domain? */
+#define SIF_BLK_BE_DOMAIN (1<<4) /* Is this a block backend domain? */
+#define SIF_NET_BE_DOMAIN (1<<5) /* Is this a net backend domain? */
+
+/* For use in guest OSes. */
+extern shared_info_t *HYPERVISOR_shared_info;
+
+#endif /* !__ASSEMBLY__ */
+
+#endif /* __XEN_PUBLIC_XEN_H__ */
#include <xen/config.h>
#include <xen/mm.h>
-#include <hypervisor-ifs/grant_table.h>
+#include <public/grant_table.h>
/* Active grant entry - used for shadowing GTF_permit_access grants. */
typedef struct {
/* Per-domain grant information. */
typedef struct {
- /* Shared grant table (see include/hypervisor-ifs/grant_table.h). */
+ /* Shared grant table (see include/public/grant_table.h). */
grant_entry_t *shared;
/* Active grant table. */
active_grant_entry_t *active;
#include <xen/smp.h>
#include <asm/page.h>
#include <asm/processor.h>
-#include <hypervisor-ifs/hypervisor-if.h>
-#include <hypervisor-ifs/dom0_ops.h>
+#include <public/xen.h>
+#include <public/dom0_ops.h>
#include <xen/list.h>
#include <xen/time.h>
#include <xen/ac_timer.h>
#define __XEN_TIME_H__
#include <xen/types.h>
-#include <hypervisor-ifs/hypervisor-if.h>
+#include <public/xen.h>
extern int init_xen_time();
* Access to the trace buffers is via a dom0 hypervisor op and analysis of
* trace buffer contents can then be performed using a userland tool.
*
- * See also common/trace.c and the dom0 op in include/hypervisor-ifs/dom0_ops.h
+ * See also common/trace.c and the dom0 op in include/public/dom0_ops.h
*/
#ifndef __XEN_TRACE_H__
#define __XEN_TRACE_H__
-#include <hypervisor-ifs/trace.h>
+#include <public/trace.h>
#ifdef TRACE_BUFFER
#include <asm/atomic.h>
#include <asm/current.h>
#include <asm/msr.h>
-#include <hypervisor-ifs/dom0_ops.h>
+#include <public/dom0_ops.h>
/* Used to initialise trace buffer functionality */
void init_trace_bufs(void);